cvs: /php4/ext/oci8 oci8.c php_oci8.h /php4/ext/oracle oracle.c php_oracle.h
| From: | Thies C. Arntzen | Date: | Thu, 09 Dec 1999 11:02:42 +0000 |
| Subject: | cvs: /php4/ext/oci8 oci8.c php_oci8.h /php4/ext/oracle oracle.c php_oracle.h | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-7709@lists.php.net to get a copy of this message | ||
thies Thu Dec 9 06:02:42 1999 EDT
Modified files:
/php4/ext/oci8 oci8.c php_oci8.h
/php4/ext/oracle oracle.c php_oracle.h
Log:
small cleanups in MINIT code
OCIInitialize is now called at the "right" spot again
Index: php4/ext/oci8/oci8.c
diff -u php4/ext/oci8/oci8.c:1.42 php4/ext/oci8/oci8.c:1.43
--- php4/ext/oci8/oci8.c:1.42 Wed Dec 8 09:04:55 1999
+++ php4/ext/oci8/oci8.c Thu Dec 9 06:02:40 1999
@@ -22,7 +22,7 @@
#define OCI_USE_EMALLOC 0 /* set this to 1 if you want to use the php memory manager! */
-/* $Id: oci8.c,v 1.42 1999/12/08 14:04:55 thies Exp $ */
+/* $Id: oci8.c,v 1.43 1999/12/09 11:02:40 thies Exp $ */
/* TODO list:
*
@@ -301,8 +301,7 @@
/* {{{ startup, shutdown and info functions */
-#ifdef ZTS
-static void php_oci_init_globals(php_oci_globals *oci_globals)
+static void php_oci_init_globals(OCILS_D)
{
OCI(user_num) = 1000;
OCI(server_num) = 2000;
@@ -321,32 +320,28 @@
NULL);
}
-#endif
PHP_MINIT_FUNCTION(oci)
{
zend_class_entry oci_lob_class_entry;
ELS_FETCH();
-#ifdef ZTS
- oci_globals_id = ts_allocate_id(sizeof(php_oci_globals), (ts_allocate_ctor) php_oci_init_globals,
NULL);
+#ifdef ZTS
+ #define PHP_OCI_INIT_MODE OCI_THREADED
#else
- OCI(user_num) = 1000;
- OCI(server_num) = 2000;
-
- OCI(user) = malloc(sizeof(HashTable));
- zend_hash_init(OCI(user), 13, NULL, NULL, 1);
+ #define PHP_OCI_INIT_MODE OCI_DEFAULT
+#endif
- OCI(server) = malloc(sizeof(HashTable));
- zend_hash_init(OCI(server), 13, NULL, NULL, 1);
+#if OCI_USE_EMALLOC
+ OCIInitialize(PHP_OCI_INIT_MODE, NULL, ocimalloc, ocirealloc, ocifree);
+#else
+ OCIInitialize(PHP_OCI_INIT_MODE, NULL, NULL, NULL, NULL);
+#endif
- OCIEnvInit(&OCI(pEnv), OCI_DEFAULT, 0, NULL);
- OCIHandleAlloc(OCI(pEnv),
- (dvoid **)&OCI(pError),
- OCI_HTYPE_ERROR,
- 0,
- NULL);
-
+#ifdef ZTS
+ oci_globals_id = ts_allocate_id(sizeof(php_oci_globals), (ts_allocate_ctor) php_oci_init_globals,
NULL);
+#else
+ php_oci_init_globals(OCILS_C);
#endif
le_stmt = register_list_destructors(_oci_statement_dtor, NULL);
@@ -392,18 +387,6 @@
REGISTER_LONG_CONSTANT("OCI_D_FILE",OCI_DTYPE_FILE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_D_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("OCI_D_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT);
-
-#ifdef ZTS
- #define PHP_OCI_INIT_MODE OCI_THREADED
-#else
- #define PHP_OCI_INIT_MODE OCI_DEFAULT
-#endif
-
-#if OCI_USE_EMALLOC
- OCIInitialize(PHP_OCI_INIT_MODE, NULL, ocimalloc, ocirealloc, ocifree);
-#else
- OCIInitialize(PHP_OCI_INIT_MODE, NULL, NULL, NULL, NULL);
-#endif
return SUCCESS;
}
Index: php4/ext/oci8/php_oci8.h
diff -u php4/ext/oci8/php_oci8.h:1.1 php4/ext/oci8/php_oci8.h:1.2
--- php4/ext/oci8/php_oci8.h:1.1 Sat Dec 4 14:15:56 1999
+++ php4/ext/oci8/php_oci8.h Thu Dec 9 06:02:40 1999
@@ -180,7 +180,7 @@
#ifdef ZTS
#define OCILS_D php_oci_globals *oci_globals
-#define OCILS_DC , PSLS_D
+#define OCILS_DC , OCILS_D
#define OCILS_C oci_globals
#define OCILS_CC , OCILS_C
#define OCI(v) (oci_globals->v)
Index: php4/ext/oracle/oracle.c
diff -u php4/ext/oracle/oracle.c:1.28 php4/ext/oracle/oracle.c:1.29
--- php4/ext/oracle/oracle.c:1.28 Sat Dec 4 14:15:58 1999
+++ php4/ext/oracle/oracle.c Thu Dec 9 06:02:41 1999
@@ -254,8 +254,7 @@
return 1;
}
-#ifdef ZTS
-static void php_ora_init_globals(php_ora_globals *ora_globals)
+static void php_ora_init_globals(ORALS_D)
{
if (cfg_get_long("oracle.allow_persistent",
&ORA(allow_persistent))
@@ -278,36 +277,16 @@
ORA(conns) = malloc(sizeof(HashTable));
zend_hash_init(ORA(conns), 13, NULL, NULL, 1);
}
-#endif
+
PHP_MINIT_FUNCTION(oracle)
{
ELS_FETCH();
#ifdef ZTS
- ora_globals_id = ts_allocate_id(sizeof(php_ora_globals), php_ora_init_globals, NULL);
+ ora_globals_id = ts_allocate_id(sizeof(php_ora_globals), (ts_allocate_ctor) php_ora_init_globals,
NULL);
#else
- if (cfg_get_long("oracle.allow_persistent",
- &ORA(allow_persistent))
- == FAILURE) {
- ORA(allow_persistent) = -1;
- }
- if (cfg_get_long("oracle.max_persistent",
- &ORA(max_persistent))
- == FAILURE) {
- ORA(max_persistent) = -1;
- }
- if (cfg_get_long("oracle.max_links",
- &ORA(max_links))
- == FAILURE) {
- ORA(max_links) = -1;
- }
-
- ORA(num_persistent) = 0;
-
-
- ORA(conns) = malloc(sizeof(HashTable));
- zend_hash_init(ORA(conns), 13, NULL, NULL, 1);
+ php_ora_init_globals(ORALS_C);
#endif
le_cursor = register_list_destructors(_close_oracur, NULL);
Index: php4/ext/oracle/php_oracle.h
diff -u php4/ext/oracle/php_oracle.h:1.1 php4/ext/oracle/php_oracle.h:1.2
--- php4/ext/oracle/php_oracle.h:1.1 Sat Dec 4 14:15:58 1999
+++ php4/ext/oracle/php_oracle.h Thu Dec 9 06:02:41 1999
@@ -1,4 +1,4 @@
-/* $Id: php_oracle.h,v 1.1 1999/12/04 19:15:58 sas Exp $ */
+/* $Id: php_oracle.h,v 1.2 1999/12/09 11:02:41 thies Exp $ */
/* synced with oracle.h,v 1.40 1999/06/01 08:11:04 thies Exp $ */
@@ -30,7 +30,7 @@
#ifdef ZTS
#define ORALS_D php_ora_globals *ora_globals
-#define ORALS_DC , PSLS_D
+#define ORALS_DC , ORACLE_D
#define ORALS_C ora_globals
#define ORALS_CC , ORALS_C
#define ORA(v) (ora_globals->v)