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