xref: /PHP-7.4/ext/pdo_firebird/pdo_firebird.c (revision 58b17906)
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: Ard Biesheuvel <abies@php.net>                               |
16   +----------------------------------------------------------------------+
17 */
18 
19 #ifdef HAVE_CONFIG_H
20 #include "config.h"
21 #endif
22 
23 #include "php.h"
24 #include "php_ini.h"
25 #include "ext/standard/info.h"
26 #include "pdo/php_pdo.h"
27 #include "pdo/php_pdo_driver.h"
28 #include "php_pdo_firebird.h"
29 #include "php_pdo_firebird_int.h"
30 
31 static const zend_function_entry pdo_firebird_functions[] = { /* {{{ */
32 	PHP_FE_END
33 };
34 /* }}} */
35 
36 /* {{{ pdo_firebird_deps
37  */
38 static const zend_module_dep pdo_firebird_deps[] = {
39 	ZEND_MOD_REQUIRED("pdo")
40 	ZEND_MOD_END
41 };
42 /* }}} */
43 
44 zend_module_entry pdo_firebird_module_entry = { /* {{{ */
45 	STANDARD_MODULE_HEADER_EX, NULL,
46 	pdo_firebird_deps,
47 	"PDO_Firebird",
48 	pdo_firebird_functions,
49 	PHP_MINIT(pdo_firebird),
50 	PHP_MSHUTDOWN(pdo_firebird),
51 	NULL,
52 	NULL,
53 	PHP_MINFO(pdo_firebird),
54 	PHP_PDO_FIREBIRD_VERSION,
55 	STANDARD_MODULE_PROPERTIES
56 };
57 /* }}} */
58 
59 #ifdef COMPILE_DL_PDO_FIREBIRD
60 ZEND_GET_MODULE(pdo_firebird)
61 #endif
62 
PHP_MINIT_FUNCTION(pdo_firebird)63 PHP_MINIT_FUNCTION(pdo_firebird) /* {{{ */
64 {
65 	REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_DATE_FORMAT", (zend_long) PDO_FB_ATTR_DATE_FORMAT);
66 	REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIME_FORMAT", (zend_long) PDO_FB_ATTR_TIME_FORMAT);
67 	REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIMESTAMP_FORMAT", (zend_long) PDO_FB_ATTR_TIMESTAMP_FORMAT);
68 
69 	php_pdo_register_driver(&pdo_firebird_driver);
70 
71 	return SUCCESS;
72 }
73 /* }}} */
74 
PHP_MSHUTDOWN_FUNCTION(pdo_firebird)75 PHP_MSHUTDOWN_FUNCTION(pdo_firebird) /* {{{ */
76 {
77 	php_pdo_unregister_driver(&pdo_firebird_driver);
78 
79 	return SUCCESS;
80 }
81 /* }}} */
82 
PHP_MINFO_FUNCTION(pdo_firebird)83 PHP_MINFO_FUNCTION(pdo_firebird) /* {{{ */
84 {
85 	char version[64];
86 	isc_get_client_version(version);
87 
88 	php_info_print_table_start();
89 	php_info_print_table_header(2, "PDO Driver for Firebird", "enabled");
90 	php_info_print_table_row(2, "Client Library Version", version);
91 	php_info_print_table_end();
92 }
93 /* }}} */
94