xref: /PHP-5.5/ext/pdo_oci/pdo_oci.c (revision 73c1be26)
1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 5                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 1997-2015 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 /* $Id$ */
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_oci.h"
31 #include "php_pdo_oci_int.h"
32 
33 /* {{{ pdo_oci_functions[] */
34 const zend_function_entry pdo_oci_functions[] = {
35 	PHP_FE_END
36 };
37 /* }}} */
38 
39 /* {{{ pdo_oci_module_entry */
40 
41 #if ZEND_MODULE_API_NO >= 20050922
42 static const zend_module_dep pdo_oci_deps[] = {
43 	ZEND_MOD_REQUIRED("pdo")
44 	ZEND_MOD_END
45 };
46 #endif
47 
48 zend_module_entry pdo_oci_module_entry = {
49 #if ZEND_MODULE_API_NO >= 20050922
50 	STANDARD_MODULE_HEADER_EX, NULL,
51 	pdo_oci_deps,
52 #else
53 	STANDARD_MODULE_HEADER,
54 #endif
55 	"PDO_OCI",
56 	pdo_oci_functions,
57 	PHP_MINIT(pdo_oci),
58 	PHP_MSHUTDOWN(pdo_oci),
59 	NULL,
60 	NULL,
61 	PHP_MINFO(pdo_oci),
62 	"1.0.1",
63 	STANDARD_MODULE_PROPERTIES
64 };
65 /* }}} */
66 
67 #ifdef COMPILE_DL_PDO_OCI
68 ZEND_GET_MODULE(pdo_oci)
69 #endif
70 
71 const ub4 PDO_OCI_INIT_MODE =
72 #if 0 && defined(OCI_SHARED)
73 			/* shared mode is known to be bad for PHP */
74 			OCI_SHARED
75 #else
76 			OCI_DEFAULT
77 #endif
78 #ifdef OCI_OBJECT
79 			|OCI_OBJECT
80 #endif
81 #ifdef ZTS
82 			|OCI_THREADED
83 #endif
84 			;
85 
86 /* true global environment */
87 OCIEnv *pdo_oci_Env = NULL;
88 
89 /* {{{ PHP_MINIT_FUNCTION
90  */
PHP_MINIT_FUNCTION(pdo_oci)91 PHP_MINIT_FUNCTION(pdo_oci)
92 {
93 	php_pdo_register_driver(&pdo_oci_driver);
94 
95 #if HAVE_OCIENVCREATE
96 	OCIEnvCreate(&pdo_oci_Env, PDO_OCI_INIT_MODE, NULL, NULL, NULL, NULL, 0, NULL);
97 #else
98 	OCIInitialize(PDO_OCI_INIT_MODE, NULL, NULL, NULL, NULL);
99 	OCIEnvInit(&pdo_oci_Env, OCI_DEFAULT, 0, NULL);
100 #endif
101 
102 	return SUCCESS;
103 }
104 /* }}} */
105 
106 /* {{{ PHP_MSHUTDOWN_FUNCTION
107  */
PHP_MSHUTDOWN_FUNCTION(pdo_oci)108 PHP_MSHUTDOWN_FUNCTION(pdo_oci)
109 {
110 	php_pdo_unregister_driver(&pdo_oci_driver);
111 	OCIHandleFree((dvoid*)pdo_oci_Env, OCI_HTYPE_ENV);
112 	return SUCCESS;
113 }
114 /* }}} */
115 
116 /* {{{ PHP_MINFO_FUNCTION
117  */
PHP_MINFO_FUNCTION(pdo_oci)118 PHP_MINFO_FUNCTION(pdo_oci)
119 {
120 	php_info_print_table_start();
121 	php_info_print_table_header(2, "PDO Driver for OCI 8 and later", "enabled");
122 	php_info_print_table_end();
123 }
124 /* }}} */
125 
126 /*
127  * Local variables:
128  * tab-width: 4
129  * c-basic-offset: 4
130  * End:
131  * vim600: noet sw=4 ts=4 fdm=marker
132  * vim<600: noet sw=4 ts=4
133  */
134