xref: /PHP-8.0/ext/pdo/php_pdo.h (revision a5cf8280)
1 /*
2   +----------------------------------------------------------------------+
3   | Copyright (c) The PHP Group                                          |
4   +----------------------------------------------------------------------+
5   | This source file is subject to version 3.01 of the PHP license,      |
6   | that is bundled with this package in the file LICENSE, and is        |
7   | available through the world-wide-web at the following url:           |
8   | http://www.php.net/license/3_01.txt                                  |
9   | If you did not receive a copy of the PHP license and are unable to   |
10   | obtain it through the world-wide-web, please send a note to          |
11   | license@php.net so we can mail you a copy immediately.               |
12   +----------------------------------------------------------------------+
13   | Author: Wez Furlong <wez@php.net>                                    |
14   +----------------------------------------------------------------------+
15 */
16 
17 #ifndef PHP_PDO_H
18 #define PHP_PDO_H
19 
20 #include "zend.h"
21 
22 extern zend_module_entry pdo_module_entry;
23 #define phpext_pdo_ptr &pdo_module_entry
24 
25 #include "php_version.h"
26 #define PHP_PDO_VERSION PHP_VERSION
27 
28 #ifdef PHP_WIN32
29 #	if defined(PDO_EXPORTS) || (!defined(COMPILE_DL_PDO))
30 #		define PDO_API __declspec(dllexport)
31 #	elif defined(COMPILE_DL_PDO)
32 #		define PDO_API __declspec(dllimport)
33 #	else
34 #		define PDO_API /* nothing special */
35 #	endif
36 #elif defined(__GNUC__) && __GNUC__ >= 4
37 #	define PDO_API __attribute__ ((visibility("default")))
38 #else
39 #	define PDO_API /* nothing special */
40 #endif
41 
42 #ifdef ZTS
43 # include "TSRM.h"
44 #endif
45 
46 PHP_MINIT_FUNCTION(pdo);
47 PHP_MSHUTDOWN_FUNCTION(pdo);
48 PHP_MINFO_FUNCTION(pdo);
49 
50 #define REGISTER_PDO_CLASS_CONST_LONG(const_name, value) \
51 	zend_declare_class_constant_long(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, (zend_long)value);
52 
53 #define REGISTER_PDO_CLASS_CONST_STRING(const_name, value) \
54 	zend_declare_class_constant_stringl(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, value, sizeof(value)-1);
55 
56 #define PDO_CONSTRUCT_CHECK \
57 	if (!dbh->driver) { \
58 		zend_throw_error(NULL, "PDO object is not initialized, constructor was not called"); \
59 		RETURN_THROWS(); \
60 	} \
61 
62 
63 #endif	/* PHP_PDO_H */
64