1 | /* |
2 | +----------------------------------------------------------------------+ |
3 | | PHP Version 5 | |
4 | +----------------------------------------------------------------------+ |
5 | | Copyright (c) 1997-2015 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: Wez Furlong <wez@php.net> | |
16 | +----------------------------------------------------------------------+ |
17 | */ |
18 | |
19 | /* $Id$ */ |
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 /* nothing special */ |
40 | # endif |
41 | #elif defined(__GNUC__) && __GNUC__ >= 4 |
42 | # define PDO_API __attribute__ ((visibility("default"))) |
43 | #else |
44 | # define PDO_API /* nothing special */ |
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 /* PHP_PDO_H */ |
85 | |
86 | |
87 | /* |
88 | * Local variables: |
89 | * tab-width: 4 |
90 | * c-basic-offset: 4 |
91 | * End: |
92 | * vim600: noet sw=4 ts=4 fdm=marker |
93 | * vim<600: noet sw=4 ts=4 |
94 | */ |
95 | |