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 #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_sqlite.h"
29 #include "php_pdo_sqlite_int.h"
30 #include "zend_exceptions.h"
31
32 /* {{{ pdo_sqlite_functions[] */
33 static const zend_function_entry pdo_sqlite_functions[] = {
34 PHP_FE_END
35 };
36 /* }}} */
37
38 /* {{{ pdo_sqlite_deps
39 */
40 static const zend_module_dep pdo_sqlite_deps[] = {
41 ZEND_MOD_REQUIRED("pdo")
42 ZEND_MOD_END
43 };
44 /* }}} */
45
46 /* {{{ pdo_sqlite_module_entry
47 */
48 zend_module_entry pdo_sqlite_module_entry = {
49 STANDARD_MODULE_HEADER_EX, NULL,
50 pdo_sqlite_deps,
51 "pdo_sqlite",
52 pdo_sqlite_functions,
53 PHP_MINIT(pdo_sqlite),
54 PHP_MSHUTDOWN(pdo_sqlite),
55 NULL,
56 NULL,
57 PHP_MINFO(pdo_sqlite),
58 PHP_PDO_SQLITE_VERSION,
59 STANDARD_MODULE_PROPERTIES
60 };
61 /* }}} */
62
63 #if defined(COMPILE_DL_PDO_SQLITE) || defined(COMPILE_DL_PDO_SQLITE_EXTERNAL)
64 ZEND_GET_MODULE(pdo_sqlite)
65 #endif
66
67 /* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(pdo_sqlite)68 PHP_MINIT_FUNCTION(pdo_sqlite)
69 {
70 #ifdef SQLITE_DETERMINISTIC
71 REGISTER_PDO_CLASS_CONST_LONG("SQLITE_DETERMINISTIC", (zend_long)SQLITE_DETERMINISTIC);
72 #endif
73
74 REGISTER_PDO_CLASS_CONST_LONG("SQLITE_ATTR_OPEN_FLAGS", (zend_long)PDO_SQLITE_ATTR_OPEN_FLAGS);
75 REGISTER_PDO_CLASS_CONST_LONG("SQLITE_OPEN_READONLY", (zend_long)SQLITE_OPEN_READONLY);
76 REGISTER_PDO_CLASS_CONST_LONG("SQLITE_OPEN_READWRITE", (zend_long)SQLITE_OPEN_READWRITE);
77 REGISTER_PDO_CLASS_CONST_LONG("SQLITE_OPEN_CREATE", (zend_long)SQLITE_OPEN_CREATE);
78 REGISTER_PDO_CLASS_CONST_LONG("SQLITE_ATTR_READONLY_STATEMENT", (zend_long)PDO_SQLITE_ATTR_READONLY_STATEMENT);
79 REGISTER_PDO_CLASS_CONST_LONG("SQLITE_ATTR_EXTENDED_RESULT_CODES", (zend_long)PDO_SQLITE_ATTR_EXTENDED_RESULT_CODES);
80
81 return php_pdo_register_driver(&pdo_sqlite_driver);
82 }
83 /* }}} */
84
85 /* {{{ PHP_MSHUTDOWN_FUNCTION */
PHP_MSHUTDOWN_FUNCTION(pdo_sqlite)86 PHP_MSHUTDOWN_FUNCTION(pdo_sqlite)
87 {
88 php_pdo_unregister_driver(&pdo_sqlite_driver);
89 return SUCCESS;
90 }
91 /* }}} */
92
93 /* {{{ PHP_MINFO_FUNCTION
94 */
PHP_MINFO_FUNCTION(pdo_sqlite)95 PHP_MINFO_FUNCTION(pdo_sqlite)
96 {
97 php_info_print_table_start();
98 php_info_print_table_header(2, "PDO Driver for SQLite 3.x", "enabled");
99 php_info_print_table_row(2, "SQLite Library", sqlite3_libversion());
100 php_info_print_table_end();
101 }
102 /* }}} */
103