php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
php_pdo_mysql_int.h
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Copyright (c) The PHP Group |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.01 of the PHP license, |
6 | that is bundled with this package in the file LICENSE, and is |
7 | available through the world-wide-web at the following url: |
8 | https://www.php.net/license/3_01.txt |
9 | If you did not receive a copy of the PHP license and are unable to |
10 | obtain it through the world-wide-web, please send a note to |
11 | license@php.net so we can mail you a copy immediately. |
12 +----------------------------------------------------------------------+
13 | Author: George Schlossnagle <george@omniti.com> |
14 | Wez Furlong <wez@php.net> |
15 | Johannes Schlueter <johannes@mysql.com> |
16 +----------------------------------------------------------------------+
17*/
18
19/* internal header; not supposed to be installed */
20
21#ifndef PHP_PDO_MYSQL_INT_H
22#define PHP_PDO_MYSQL_INT_H
23
24#ifdef PDO_USE_MYSQLND
25# include "ext/mysqlnd/mysqlnd.h"
27# define PDO_MYSQL_PARAM_BIND MYSQLND_PARAM_BIND
28#else
29# include <mysql.h>
30#if MYSQL_VERSION_ID >= 80000 && MYSQL_VERSION_ID < 100000
31typedef _Bool my_bool;
32#endif
33# define PDO_MYSQL_PARAM_BIND MYSQL_BIND
34#endif
35
36#if defined(PDO_USE_MYSQLND) && PHP_DEBUG && !defined(PHP_WIN32)
37#define PDO_DBG_ENABLED 1
38
39#define PDO_DBG_INF(msg) do { if (!dbg_skip_trace) PDO_MYSQL_G(dbg)->m->log(PDO_MYSQL_G(dbg), __LINE__, __FILE__, -1, "info : ", (msg)); } while (0)
40#define PDO_DBG_ERR(msg) do { if (!dbg_skip_trace) PDO_MYSQL_G(dbg)->m->log(PDO_MYSQL_G(dbg), __LINE__, __FILE__, -1, "error: ", (msg)); } while (0)
41#define PDO_DBG_INF_FMT(...) do { if (!dbg_skip_trace) PDO_MYSQL_G(dbg)->m->log_va(PDO_MYSQL_G(dbg), __LINE__, __FILE__, -1, "info : ", __VA_ARGS__); } while (0)
42#define PDO_DBG_ERR_FMT(...) do { if (!dbg_skip_trace) PDO_MYSQL_G(dbg)->m->log_va(PDO_MYSQL_G(dbg), __LINE__, __FILE__, -1, "error: ", __VA_ARGS__); } while (0)
43#define PDO_DBG_ENTER(func_name) \
44 bool dbg_skip_trace = true; \
45 ((void) dbg_skip_trace); \
46 if (PDO_MYSQL_G(dbg)) \
47 dbg_skip_trace = !PDO_MYSQL_G(dbg)->m->func_enter(PDO_MYSQL_G(dbg), __LINE__, __FILE__, func_name, strlen(func_name));
48
49#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)
50#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)
51
52#else
53#define PDO_DBG_ENABLED 0
54
55static inline void PDO_DBG_INF(char *msg) {}
56static inline void PDO_DBG_ERR(char *msg) {}
57static inline void PDO_DBG_INF_FMT(char *format, ...) {}
58static inline void PDO_DBG_ERR_FMT(char *format, ...) {}
59static inline void PDO_DBG_ENTER(char *func_name) {}
60#define PDO_DBG_RETURN(value) return (value)
61#define PDO_DBG_VOID_RETURN return;
62
63#endif
64
65#ifdef PDO_USE_MYSQLND
67#endif
68
70#ifndef PHP_WIN32
72#endif
73#if PDO_DBG_ENABLED
74 char *debug; /* The actual string */
75 MYSQLND_DEBUG *dbg; /* The DBG object */
76#endif
77#if defined(PHP_WIN32) && !PDO_DBG_ENABLED
78 /* dummy member so we get at least one member in the struct
79 * and avoids build errors.
80 */
81 void *dummymemmber;
82#endif
84
86#define PDO_MYSQL_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(pdo_mysql, v)
87
88#if defined(ZTS) && defined(COMPILE_DL_PDO_MYSQL)
90#endif
91
92
93typedef struct {
94 const char *file;
95 int line;
96 unsigned int errcode;
97 char *errmsg;
99
100/* stuff we use in a mySQL database handle */
101typedef struct {
103
105 unsigned attached:1;
106 unsigned buffered:1;
107 unsigned emulate_prepare:1;
109 unsigned local_infile:1;
110#ifndef PDO_USE_MYSQLND
112#endif
113
116
117typedef struct {
120
121typedef struct {
126#ifdef PDO_USE_MYSQLND
128#else
130#endif
133#ifndef PDO_USE_MYSQLND
140 unsigned long *current_lengths;
141#else
142 zval *current_row;
143#endif
144 unsigned max_length:1;
145 /* Whether all result sets have been fully consumed.
146 * If this flag is not set, they need to be consumed during destruction. */
147 unsigned done:1;
149
150extern const pdo_driver_t pdo_mysql_driver;
151
153
154extern int _pdo_mysql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int line);
155#define pdo_mysql_error(s) _pdo_mysql_error(s, NULL, __FILE__, __LINE__)
156#define pdo_mysql_error_stmt(s) _pdo_mysql_error(stmt->dbh, stmt, __FILE__, __LINE__)
157
158extern const struct pdo_stmt_methods mysql_stmt_methods;
159
160enum {
164#ifndef PDO_USE_MYSQLND
168#endif
178#if MYSQL_VERSION_ID > 50605 || defined(PDO_USE_MYSQLND)
179 PDO_MYSQL_ATTR_SERVER_PUBLIC_KEY,
180#endif
182#ifdef PDO_USE_MYSQLND
183 PDO_MYSQL_ATTR_SSL_VERIFY_SERVER_CERT,
184#endif
185#if MYSQL_VERSION_ID >= 80021 || defined(PDO_USE_MYSQLND)
186 PDO_MYSQL_ATTR_LOCAL_INFILE_DIRECTORY,
187#endif
188};
189
190#endif
file(string $filename, int $flags=0, $context=null)
char s[4]
Definition cdf.c:77
const pdo_driver_t pdo_mysql_driver
const struct pdo_stmt_methods mysql_stmt_methods
MYSQLND_DEBUG * dbg
Definition mysqlnd.h:300
char * debug
Definition mysqlnd.h:298
#define MYSQL_RES
#define MYSQL_ROW
#define MYSQL
#define my_bool
#define MYSQL_STMT
#define MYSQL_FIELD
struct st_mysqlnd_debug MYSQLND_DEBUG
struct st_mysqlnd_stmt MYSQLND_STMT
int line
Definition php_ffi.h:54
char * default_socket
struct _pdo_dbh_t pdo_dbh_t
struct _pdo_stmt_t pdo_stmt_t
struct _pdo_scanner_t pdo_scanner_t
@ PDO_ATTR_DRIVER_SPECIFIC
int _pdo_mysql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *file, int line)
int pdo_mysql_scanner(pdo_scanner_t *s)
#define PDO_MYSQL_PARAM_BIND
@ PDO_MYSQL_ATTR_SSL_CIPHER
@ PDO_MYSQL_ATTR_READ_DEFAULT_FILE
@ PDO_MYSQL_ATTR_SSL_CERT
@ PDO_MYSQL_ATTR_FOUND_ROWS
@ PDO_MYSQL_ATTR_DIRECT_QUERY
@ PDO_MYSQL_ATTR_MAX_BUFFER_SIZE
@ PDO_MYSQL_ATTR_READ_DEFAULT_GROUP
@ PDO_MYSQL_ATTR_COMPRESS
@ PDO_MYSQL_ATTR_LOCAL_INFILE
@ PDO_MYSQL_ATTR_USE_BUFFERED_QUERY
@ PDO_MYSQL_ATTR_IGNORE_SPACE
@ PDO_MYSQL_ATTR_SSL_KEY
@ PDO_MYSQL_ATTR_INIT_COMMAND
@ PDO_MYSQL_ATTR_SSL_CAPATH
@ PDO_MYSQL_ATTR_SSL_CA
@ PDO_MYSQL_ATTR_MULTI_STATEMENTS
char * msg
Definition phpdbg.h:289
const char * func_name
pdo_mysql_error_info einfo
unsigned assume_national_character_set_strings
PDO_MYSQL_PARAM_BIND * bound_result
zend_ulong * out_length
unsigned long * current_lengths
pdo_mysql_db_handle * H
pdo_mysql_error_info einfo
const MYSQL_FIELD * fields
PDO_MYSQL_PARAM_BIND * params
zend_ulong * in_length
#define ZEND_TSRMLS_CACHE_EXTERN()
Definition zend.h:67
#define ZEND_END_MODULE_GLOBALS(module_name)
Definition zend_API.h:248
#define ZEND_EXTERN_MODULE_GLOBALS(module_name)
Definition zend_API.h:270
#define ZEND_BEGIN_MODULE_GLOBALS(module_name)
Definition zend_API.h:246
struct _zval_struct zval
uint32_t zend_ulong
Definition zend_long.h:43