1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #ifndef PHP_PDO_H
22 #define PHP_PDO_H
23
24 #include "zend.h"
25
26 #if PHP_MAJOR_VERSION > 5 || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1)
27 #define can_handle_soft_dependency_on_SPL 1
28 #endif
29
30 extern zend_module_entry pdo_module_entry;
31 #define phpext_pdo_ptr &pdo_module_entry
32
33 #ifdef PHP_WIN32
34 # if defined(PDO_EXPORTS) || (!defined(COMPILE_DL_PDO))
35 # define PDO_API __declspec(dllexport)
36 # elif defined(COMPILE_DL_PDO)
37 # define PDO_API __declspec(dllimport)
38 # else
39 # define PDO_API
40 # endif
41 #elif defined(__GNUC__) && __GNUC__ >= 4
42 # define PDO_API __attribute__ ((visibility("default")))
43 #else
44 # define PDO_API
45 #endif
46
47 #ifdef ZTS
48 # include "TSRM.h"
49 #endif
50
51 PHP_MINIT_FUNCTION(pdo);
52 PHP_MSHUTDOWN_FUNCTION(pdo);
53 PHP_MINFO_FUNCTION(pdo);
54
55 ZEND_BEGIN_MODULE_GLOBALS(pdo)
56 long global_value;
57 ZEND_END_MODULE_GLOBALS(pdo)
58
59 #ifdef ZTS
60 # define PDOG(v) TSRMG(pdo_globals_id, zend_pdo_globals *, v)
61 #else
62 # define PDOG(v) (pdo_globals.v)
63 #endif
64
65 #define REGISTER_PDO_CLASS_CONST_LONG(const_name, value) \
66 zend_declare_class_constant_long(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, (long)value TSRMLS_CC);
67
68 #define REGISTER_PDO_CONST_LONG(const_name, value) { \
69 zend_class_entry **pce; \
70 if (zend_hash_find(CG(class_table), "pdo", sizeof("pdo"), (void **) &pce) != FAILURE) \
71 zend_declare_class_constant_long(*pce, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); \
72 } \
73
74 #define REGISTER_PDO_CLASS_CONST_STRING(const_name, value) \
75 zend_declare_class_constant_stringl(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, value, sizeof(value)-1 TSRMLS_CC);
76
77 #define PDO_CONSTRUCT_CHECK \
78 if (!dbh->driver) { \
79 pdo_raise_impl_error(dbh, NULL, "00000", "PDO constructor was not called" TSRMLS_CC); \
80 return; \
81 } \
82
83
84 #endif
85
86
87
88
89
90
91
92
93
94