xref: /PHP-7.4/ext/pdo/php_pdo.h (revision 5aa11762)
1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 7                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 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 #define REGISTER_PDO_CLASS_CONST_LONG(const_name, value) \
53 	zend_declare_class_constant_long(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, (zend_long)value);
54 
55 #define REGISTER_PDO_CLASS_CONST_STRING(const_name, value) \
56 	zend_declare_class_constant_stringl(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, value, sizeof(value)-1);
57 
58 #define PDO_CONSTRUCT_CHECK	\
59 	if (!dbh->driver) {	\
60 		pdo_raise_impl_error(dbh, NULL, "00000", "PDO constructor was not called");	\
61 		return;	\
62 	}	\
63 
64 
65 #endif	/* PHP_PDO_H */
66