xref: /PHP-7.2/ext/pdo_pgsql/pdo_pgsql.c (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: Edin Kadribasic <edink@emini.dk>                             |
16   +----------------------------------------------------------------------+
17 */
18 
19 /* $Id: 9c5f356c77143981d2e905e276e439501fe0f419 $ */
20 
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
24 
25 #include "php.h"
26 #include "php_ini.h"
27 #include "ext/standard/info.h"
28 #include "pdo/php_pdo.h"
29 #include "pdo/php_pdo_driver.h"
30 #include "php_pdo_pgsql.h"
31 #include "php_pdo_pgsql_int.h"
32 
33 #ifdef HAVE_PG_CONFIG_H
34 #undef PACKAGE_BUGREPORT
35 #undef PACKAGE_NAME
36 #undef PACKAGE_STRING
37 #undef PACKAGE_TARNAME
38 #undef PACKAGE_VERSION
39 #include <pg_config.h>
40 #endif
41 
42 /* {{{ pdo_pgsql_functions[] */
43 const zend_function_entry pdo_pgsql_functions[] = {
44 	PHP_FE_END
45 };
46 /* }}} */
47 
48 /* {{{ pdo_sqlite_deps
49  */
50 static const zend_module_dep pdo_pgsql_deps[] = {
51 	ZEND_MOD_REQUIRED("pdo")
52 	ZEND_MOD_END
53 };
54 /* }}} */
55 
56 /* {{{ pdo_pgsql_module_entry */
57 zend_module_entry pdo_pgsql_module_entry = {
58 	STANDARD_MODULE_HEADER_EX, NULL,
59 	pdo_pgsql_deps,
60 	"pdo_pgsql",
61 	pdo_pgsql_functions,
62 	PHP_MINIT(pdo_pgsql),
63 	PHP_MSHUTDOWN(pdo_pgsql),
64 	NULL,
65 	NULL,
66 	PHP_MINFO(pdo_pgsql),
67 	PHP_PDO_PGSQL_VERSION,
68 	STANDARD_MODULE_PROPERTIES
69 };
70 /* }}} */
71 
72 #ifdef COMPILE_DL_PDO_PGSQL
73 ZEND_GET_MODULE(pdo_pgsql)
74 #endif
75 
76 /* true global environment */
77 
78 /* {{{ PHP_MINIT_FUNCTION
79  */
PHP_MINIT_FUNCTION(pdo_pgsql)80 PHP_MINIT_FUNCTION(pdo_pgsql)
81 {
82 	REGISTER_PDO_CLASS_CONST_LONG("PGSQL_ATTR_DISABLE_PREPARES", PDO_PGSQL_ATTR_DISABLE_PREPARES);
83 	REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_IDLE", (zend_long)PGSQL_TRANSACTION_IDLE);
84 	REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_ACTIVE", (zend_long)PGSQL_TRANSACTION_ACTIVE);
85 	REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INTRANS", (zend_long)PGSQL_TRANSACTION_INTRANS);
86 	REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INERROR", (zend_long)PGSQL_TRANSACTION_INERROR);
87 	REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_UNKNOWN", (zend_long)PGSQL_TRANSACTION_UNKNOWN);
88 
89 	php_pdo_register_driver(&pdo_pgsql_driver);
90 	return SUCCESS;
91 }
92 /* }}} */
93 
94 /* {{{ PHP_MSHUTDOWN_FUNCTION
95  */
PHP_MSHUTDOWN_FUNCTION(pdo_pgsql)96 PHP_MSHUTDOWN_FUNCTION(pdo_pgsql)
97 {
98 	php_pdo_unregister_driver(&pdo_pgsql_driver);
99 	return SUCCESS;
100 }
101 /* }}} */
102 
103 /* {{{ PHP_MINFO_FUNCTION
104  */
PHP_MINFO_FUNCTION(pdo_pgsql)105 PHP_MINFO_FUNCTION(pdo_pgsql)
106 {
107 	php_info_print_table_start();
108 	php_info_print_table_header(2, "PDO Driver for PostgreSQL", "enabled");
109 #ifdef HAVE_PG_CONFIG_H
110 	php_info_print_table_row(2, "PostgreSQL(libpq) Version", PG_VERSION);
111 #endif
112 	php_info_print_table_row(2, "Module version", pdo_pgsql_module_entry.version);
113 	php_info_print_table_row(2, "Revision", " $Id: 9c5f356c77143981d2e905e276e439501fe0f419 $ ");
114 
115 	php_info_print_table_end();
116 }
117 /* }}} */
118 
119 /*
120  * Local variables:
121  * tab-width: 4
122  * c-basic-offset: 4
123  * End:
124  * vim600: noet sw=4 ts=4 fdm=marker
125  * vim<600: noet sw=4 ts=4
126  */
127