diff options
author | Thies C. Arntzen <thies@php.net> | 2002-09-12 09:48:03 +0000 |
---|---|---|
committer | Thies C. Arntzen <thies@php.net> | 2002-09-12 09:48:03 +0000 |
commit | b905e40e92dce3ad6eaeae3d09f0f003c5accde3 (patch) | |
tree | f4b6c9493358ddac422205e4242ce636d04f9eca /ext/oci8 | |
parent | 23d3cd79c178da11b5f76b75eb6982fe35554f26 (diff) | |
download | php-git-b905e40e92dce3ad6eaeae3d09f0f003c5accde3.tar.gz |
@- OCIResult() could return garbage if called on empty result-sets. (thies)
# fix #19364
Diffstat (limited to 'ext/oci8')
-rw-r--r-- | ext/oci8/oci8.c | 9 | ||||
-rw-r--r-- | ext/oci8/php_oci8.h | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index ac29732286..54deffb198 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -1244,7 +1244,7 @@ _oci_make_zval(zval *value,oci_statement *statement,oci_out_column *column, char oci_debug("_oci_make_zval: %16s,retlen = %4d,retlen4 = %d,storage_size4 = %4d,indicator %4d, retcode = %4d", column->name,column->retlen,column->retlen4,column->storage_size4,column->indicator,column->retcode); - if (column->indicator == -1) { /* column is NULL */ + if ((! statement->has_data) || (column->indicator == -1)) { /* column is NULL or statment has no current data */ ZVAL_NULL(value); return 0; } @@ -1392,7 +1392,9 @@ static oci_statement *oci_parse(oci_connection *connection, char *query, int len if (query) { statement->last_query = estrdup(query); } + statement->conn = connection; + statement->has_data = 0; statement->id = zend_list_insert(statement,le_stmt); @@ -1769,6 +1771,7 @@ oci_fetch(oci_statement *statement, ub4 nrows, char *func TSRMLS_DC) } statement->error = 0; /* OCI_NO_DATA is NO error for us!!! */ + statement->has_data = 0; return 0; } @@ -1828,12 +1831,16 @@ oci_fetch(oci_statement *statement, ub4 nrows, char *func TSRMLS_DC) _oci_make_zval(column->define->zval,statement,column,"OCIFetch",0 TSRMLS_CC); } + statement->has_data = 1; + return 1; } oci_error(statement->pError, func, statement->error); oci_handle_error(statement->conn, statement->error); + statement->has_data = 0; + return 0; } diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h index 07fdc8e9dc..65d5e1220f 100644 --- a/ext/oci8/php_oci8.h +++ b/ext/oci8/php_oci8.h @@ -119,6 +119,7 @@ typedef struct { HashTable *defines; int ncolumns; int executed; + int has_data; ub2 stmttype; } oci_statement; |