xref: /PHP-7.3/ext/pdo/php_pdo.h (revision 8d3f8ca1)
1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 7                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 1997-2018 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 #ifndef PHP_PDO_H
20 #define PHP_PDO_H
21 
22 #include "zend.h"
23 
24 extern zend_module_entry pdo_module_entry;
25 #define phpext_pdo_ptr &pdo_module_entry
26 
27 #include "php_version.h"
28 #define PHP_PDO_VERSION PHP_VERSION
29 
30 #ifdef PHP_WIN32
31 #	if defined(PDO_EXPORTS) || (!defined(COMPILE_DL_PDO))
32 #		define PDO_API __declspec(dllexport)
33 #	elif defined(COMPILE_DL_PDO)
34 #		define PDO_API __declspec(dllimport)
35 #	else
36 #		define PDO_API /* nothing special */
37 #	endif
38 #elif defined(__GNUC__) && __GNUC__ >= 4
39 #	define PDO_API __attribute__ ((visibility("default")))
40 #else
41 #	define PDO_API /* nothing special */
42 #endif
43 
44 #ifdef ZTS
45 # include "TSRM.h"
46 #endif
47 
48 PHP_MINIT_FUNCTION(pdo);
49 PHP_MSHUTDOWN_FUNCTION(pdo);
50 PHP_MINFO_FUNCTION(pdo);
51 
52 ZEND_BEGIN_MODULE_GLOBALS(pdo)
53 	zend_long  global_value;
54 ZEND_END_MODULE_GLOBALS(pdo)
55 
56 #ifdef ZTS
57 # define PDOG(v) TSRMG(pdo_globals_id, zend_pdo_globals *, v)
58 #else
59 # define PDOG(v) (pdo_globals.v)
60 #endif
61 
62 #define REGISTER_PDO_CLASS_CONST_LONG(const_name, value) \
63 	zend_declare_class_constant_long(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, (zend_long)value);
64 
65 #define REGISTER_PDO_CLASS_CONST_STRING(const_name, value) \
66 	zend_declare_class_constant_stringl(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, value, sizeof(value)-1);
67 
68 #define PDO_CONSTRUCT_CHECK	\
69 	if (!dbh->driver) {	\
70 		pdo_raise_impl_error(dbh, NULL, "00000", "PDO constructor was not called");	\
71 		return;	\
72 	}	\
73 
74 
75 #endif	/* PHP_PDO_H */
76 
77 
78 /*
79  * Local variables:
80  * tab-width: 4
81  * c-basic-offset: 4
82  * End:
83  * vim600: noet sw=4 ts=4 fdm=marker
84  * vim<600: noet sw=4 ts=4
85  */
86