Annotation of embedaddon/php/ext/pdo_mysql/php_pdo_mysql_int.h, revision 1.1.1.2
1.1 misho 1: /*
2: +----------------------------------------------------------------------+
3: | PHP Version 5 |
4: +----------------------------------------------------------------------+
5: | Copyright (c) 1997-2012 The PHP Group |
6: +----------------------------------------------------------------------+
7: | This source file is subject to version 3.01 of the PHP license, |
8: | that is bundled with this package in the file LICENSE, and is |
9: | available through the world-wide-web at the following url: |
10: | http://www.php.net/license/3_01.txt |
11: | If you did not receive a copy of the PHP license and are unable to |
12: | obtain it through the world-wide-web, please send a note to |
13: | license@php.net so we can mail you a copy immediately. |
14: +----------------------------------------------------------------------+
15: | Author: George Schlossnagle <george@omniti.com> |
16: | Wez Furlong <wez@php.net> |
17: | Johannes Schlueter <johannes@mysql.com> |
18: +----------------------------------------------------------------------+
19: */
20:
1.1.1.2 ! misho 21: /* $Id$ */
1.1 misho 22:
23: #ifndef PHP_PDO_MYSQL_INT_H
24: #define PHP_PDO_MYSQL_INT_H
25:
26: #if defined(PDO_USE_MYSQLND)
27: # include "ext/mysqlnd/mysqlnd.h"
28: # include "ext/mysqlnd/mysqlnd_libmysql_compat.h"
29: # define PDO_MYSQL_PARAM_BIND MYSQLND_PARAM_BIND
30: #else
31: # include <mysql.h>
32: # define PDO_MYSQL_PARAM_BIND MYSQL_BIND
33: #endif
34:
35: #if (MYSQL_VERSION_ID >= 40113 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50007 || defined(MYSQL_USE_MYSQLND)
36: # define PDO_MYSQL_HAS_CHARSET
37: #endif
38:
39: #if defined(PDO_USE_MYSQLND) && PHP_DEBUG && !defined(PHP_WIN32)
40: #define PDO_DBG_ENABLED 1
41:
42: #define PDO_DBG_INF(msg) do { if (dbg_skip_trace == FALSE) PDO_MYSQL_G(dbg)->m->log(PDO_MYSQL_G(dbg), __LINE__, __FILE__, -1, "info : ", (msg)); } while (0)
43: #define PDO_DBG_ERR(msg) do { if (dbg_skip_trace == FALSE) PDO_MYSQL_G(dbg)->m->log(PDO_MYSQL_G(dbg), __LINE__, __FILE__, -1, "error: ", (msg)); } while (0)
44: #define PDO_DBG_INF_FMT(...) do { if (dbg_skip_trace == FALSE) PDO_MYSQL_G(dbg)->m->log_va(PDO_MYSQL_G(dbg), __LINE__, __FILE__, -1, "info : ", __VA_ARGS__); } while (0)
45: #define PDO_DBG_ERR_FMT(...) do { if (dbg_skip_trace == FALSE) PDO_MYSQL_G(dbg)->m->log_va(PDO_MYSQL_G(dbg), __LINE__, __FILE__, -1, "error: ", __VA_ARGS__); } while (0)
46: #define PDO_DBG_ENTER(func_name) zend_bool dbg_skip_trace = TRUE; if (PDO_MYSQL_G(dbg)) dbg_skip_trace = !PDO_MYSQL_G(dbg)->m->func_enter(PDO_MYSQL_G(dbg), __LINE__, __FILE__, func_name, strlen(func_name));
47: #define PDO_DBG_RETURN(value) do { if (PDO_MYSQL_G(dbg)) PDO_MYSQL_G(dbg)->m->func_leave(PDO_MYSQL_G(dbg), __LINE__, __FILE__, 0); return (value); } while (0)
48: #define PDO_DBG_VOID_RETURN do { if (PDO_MYSQL_G(dbg)) PDO_MYSQL_G(dbg)->m->func_leave(PDO_MYSQL_G(dbg), __LINE__, __FILE__, 0); return; } while (0)
49:
50: #else
51: #define PDO_DBG_ENABLED 0
52:
53: static inline void PDO_DBG_INF(char *msg) {}
54: static inline void PDO_DBG_ERR(char *msg) {}
55: static inline void PDO_DBG_INF_FMT(char *format, ...) {}
56: static inline void PDO_DBG_ERR_FMT(char *format, ...) {}
57: static inline void PDO_DBG_ENTER(char *func_name) {}
58: #define PDO_DBG_RETURN(value) return (value)
59: #define PDO_DBG_VOID_RETURN return;
60:
61: #endif
62:
63: #if defined(PDO_USE_MYSQLND)
64: #include "ext/mysqlnd/mysqlnd_debug.h"
65: #endif
66:
67: ZEND_BEGIN_MODULE_GLOBALS(pdo_mysql)
68: #ifndef PHP_WIN32
69: char *default_socket;
70: #endif
71: #if PDO_DBG_ENABLED
72: char *debug; /* The actual string */
73: MYSQLND_DEBUG *dbg; /* The DBG object */
74: #endif
75: #if defined(PHP_WIN32) && !PDO_DBG_ENABLED
76: /* dummy member so we get at least one member in the struct
77: * and avoids build errors.
78: */
79: void *dummymemmber;
80: #endif
81: ZEND_END_MODULE_GLOBALS(pdo_mysql)
82:
83: ZEND_EXTERN_MODULE_GLOBALS(pdo_mysql)
84:
85: #ifdef ZTS
86: #define PDO_MYSQL_G(v) TSRMG(pdo_mysql_globals_id, zend_pdo_mysql_globals *, v)
87: #else
88: #define PDO_MYSQL_G(v) (pdo_mysql_globals.v)
89: #endif
90:
91:
92: typedef struct {
93: const char *file;
94: int line;
95: unsigned int errcode;
96: char *errmsg;
97: } pdo_mysql_error_info;
98:
99: /* stuff we use in a mySQL database handle */
100: typedef struct {
101: MYSQL *server;
102:
103: unsigned attached:1;
104: unsigned buffered:1;
105: unsigned emulate_prepare:1;
106: unsigned fetch_table_names:1;
107: unsigned _reserved:31;
108: #if !PDO_USE_MYSQLND
109: unsigned long max_buffer_size;
110: #endif
111:
112: pdo_mysql_error_info einfo;
113: } pdo_mysql_db_handle;
114:
115: typedef struct {
116: MYSQL_FIELD *def;
117: } pdo_mysql_column;
118:
119: typedef struct {
120: pdo_mysql_db_handle *H;
121: MYSQL_RES *result;
122: const MYSQL_FIELD *fields;
123: MYSQL_ROW current_data;
124: #if PDO_USE_MYSQLND
125: unsigned long *current_lengths;
126: #else
127: long *current_lengths;
128: #endif
129: pdo_mysql_error_info einfo;
130: #if PDO_USE_MYSQLND
131: MYSQLND_STMT *stmt;
132: #else
133: MYSQL_STMT *stmt;
134: #endif
135: int num_params;
136: PDO_MYSQL_PARAM_BIND *params;
137: #ifndef PDO_USE_MYSQLND
138: my_bool *in_null;
139: unsigned long *in_length;
140: #endif
141: PDO_MYSQL_PARAM_BIND *bound_result;
142: my_bool *out_null;
143: unsigned long *out_length;
144: unsigned int params_given;
145: unsigned max_length:1;
146: } pdo_mysql_stmt;
147:
148: extern pdo_driver_t pdo_mysql_driver;
149:
150: extern int _pdo_mysql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int line TSRMLS_DC);
151: #define pdo_mysql_error(s) _pdo_mysql_error(s, NULL, __FILE__, __LINE__ TSRMLS_CC)
152: #define pdo_mysql_error_stmt(s) _pdo_mysql_error(stmt->dbh, stmt, __FILE__, __LINE__ TSRMLS_CC)
153:
154: extern struct pdo_stmt_methods mysql_stmt_methods;
155:
156: enum {
157: PDO_MYSQL_ATTR_USE_BUFFERED_QUERY = PDO_ATTR_DRIVER_SPECIFIC,
158: PDO_MYSQL_ATTR_LOCAL_INFILE,
159: PDO_MYSQL_ATTR_INIT_COMMAND,
160: #ifndef PDO_USE_MYSQLND
161: PDO_MYSQL_ATTR_READ_DEFAULT_FILE,
162: PDO_MYSQL_ATTR_READ_DEFAULT_GROUP,
163: PDO_MYSQL_ATTR_MAX_BUFFER_SIZE,
164: #endif
1.1.1.2 ! misho 165: PDO_MYSQL_ATTR_COMPRESS,
1.1 misho 166: PDO_MYSQL_ATTR_DIRECT_QUERY,
167: PDO_MYSQL_ATTR_FOUND_ROWS,
168: PDO_MYSQL_ATTR_IGNORE_SPACE,
169: PDO_MYSQL_ATTR_SSL_KEY,
170: PDO_MYSQL_ATTR_SSL_CERT,
171: PDO_MYSQL_ATTR_SSL_CA,
172: PDO_MYSQL_ATTR_SSL_CAPATH,
173: PDO_MYSQL_ATTR_SSL_CIPHER
174: };
175:
176: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>