From aee1dd9ec05a417218817ddf2fb6c3100d11c873 Mon Sep 17 00:00:00 2001 From: "Thies C. Arntzen" Date: Mon, 7 Feb 2000 10:31:43 +0000 Subject: [PATCH] kill warning @- Fixed some OCIBindByName() problems. (Thies) --- ext/oci8/oci8.c | 59 +++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 849e7c1ac1..85b9a391f5 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -461,28 +461,6 @@ PHP_MSHUTDOWN_FUNCTION(oci) return SUCCESS; } -#if 0 -static int _session_cleanup(oci_session *session) -{ - if (session->persistent) - return 0; - - _oci_close_session(session); - - return 1; -} - -static int _server_cleanup(oci_server *server) -{ - if (server->persistent) - return 0; - - _oci_close_server(server); - - return 1; -} -#endif - PHP_RSHUTDOWN_FUNCTION(oci) { OCILS_FETCH(); @@ -558,6 +536,23 @@ _oci_bind_pre_exec(void *data) return 0; } +/* }}} */ +/* {{{ _oci_bind_post_exec() */ + +static int +_oci_bind_post_exec(void *data) +{ + oci_bind *bind = (oci_bind *) data; + + if (bind->indicator == -1) { /* NULL */ + zval *val = bind->zval; + zval_dtor(val); + ZVAL_NULL(val); + } + + return 0; +} + /* }}} */ /* {{{ _oci_column_hash_dtor() */ @@ -1149,14 +1144,14 @@ oci_execute(oci_statement *statement, char *func,ub4 mode) iters = 1; } - if (statement->binds) { - zend_hash_apply(statement->binds, (int (*)(void *)) _oci_bind_pre_exec); - } - if (statement->last_query) { /* if we execute refcursors we don't have a query and we don't want to execute!!! */ + if (statement->binds) { + zend_hash_apply(statement->binds, (int (*)(void *)) _oci_bind_pre_exec); + } + statement->error = oci_error(statement->pError, "OCIStmtExecute", @@ -1169,6 +1164,10 @@ oci_execute(oci_statement *statement, char *func,ub4 mode) NULL, mode)); + if (statement->binds) { + zend_hash_apply(statement->binds, (int (*)(void *)) _oci_bind_post_exec); + } + switch (statement->error) { case 0: break; @@ -1734,8 +1733,9 @@ oci_bind_out_callback(dvoid *octxp, /* context pointer */ if (val->type == IS_OBJECT) { retval = OCI_CONTINUE; - } else if (val->type == IS_STRING) { - STR_FREE(val->value.str.val); + } else { + convert_to_string(val); + zval_dtor(val); val->value.str.len = OCI_PIECE_SIZE; /* 64K-1 is max XXX */ val->value.str.val = emalloc(phpbind->zval->value.str.len); @@ -2110,8 +2110,9 @@ static oci_server *_oci_open_server(char *dbname,int persistent) /* {{{ _oci_close_server() */ -static int _oci_session_cleanup(list_entry *le) +static int _oci_session_cleanup(void *data) { + list_entry *le = (list_entry *) data; if (le->type == le_session) { oci_server *server = ((oci_session*) le->ptr)->server; if (server->open == 2) -- 2.40.0