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