CVS update: php3/functions

From: Date: Thu, 18 Feb 1999 13:06:05 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-4142@lists.php.net to get a copy of this message
Date: Thursday February 18, 1999 @ 8:06 Author: thies Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv28968 Modified Files: oci8.c php3_oci8.h Log Message: OCIDefineByName works for "normal" columns... Index: php3/functions/oci8.c diff -c php3/functions/oci8.c:1.52 php3/functions/oci8.c:1.53 *** php3/functions/oci8.c:1.52 Tue Feb 16 09:58:41 1999 --- php3/functions/oci8.c Thu Feb 18 08:06:03 1999 *************** *** 32,38 **** +----------------------------------------------------------------------+ */ ! /* $Id: oci8.c,v 1.52 1999/02/16 14:58:41 thies Exp $ */ #include "php.h" #include "internal_functions.h" --- 32,38 ---- +----------------------------------------------------------------------+ */ ! /* $Id: oci8.c,v 1.53 1999/02/18 13:06:03 thies Exp $ */ #include "php.h" #include "internal_functions.h" *************** *** 426,432 **** if (column->is_descr) { _php3_hash_index_del(column->statement->conn->descriptors,(int) column->data); } else { ! efree(column->data); } } return 0; --- 426,434 ---- if (column->is_descr) { _php3_hash_index_del(column->statement->conn->descriptors,(int) column->data); } else { ! if (! column->define) { ! efree(column->data); ! } } } return 0; *************** *** 954,965 **** if (statement->defines && (_php3_hash_find(statement->defines,outcol->name,outcol->name_len,(void **) &define) == SUCCESS)) { convert_to_string(define->pval); ! if (define->pval->value.str.val) { ! /* XXX Free here */ } define->pval->value.str.val = emalloc(outcol->storage_size); define->pval->value.str.len = outcol->storage_size; outcol->data = define->pval->value.str.val; } else { outcol->data = (text *)emalloc(outcol->storage_size); } --- 956,970 ---- if (statement->defines && (_php3_hash_find(statement->defines,outcol->name,outcol->name_len,(void **) &define) == SUCCESS)) { convert_to_string(define->pval); ! if (define->pval->value.str.val && ! (define->pval->value.str.val!=undefined_variable_string) && ! (define->pval->value.str.val!=empty_string)) { ! efree(define->pval->value.str.val); } define->pval->value.str.val = emalloc(outcol->storage_size); define->pval->value.str.len = outcol->storage_size; outcol->data = define->pval->value.str.val; + outcol->define = define; } else { outcol->data = (text *)emalloc(outcol->storage_size); } *************** *** 1011,1033 **** oci8_fetch(oci8_statement *statement, ub4 nrows, char *func) { sword error; OCI8_TLS_VARS; error = OCIStmtFetch(statement->pStmt, statement->pError, nrows, OCI_FETCH_NEXT, OCI_DEFAULT); - /* - oci8_debug("OCIStmtFetch returned %d", error); - */ - if (error == OCI_NO_DATA) { return 0; } if (error == OCI_SUCCESS_WITH_INFO || error == OCI_SUCCESS) { return 1; } oci8_error(statement->pError, func, error); return 0; } --- 1016,1053 ---- oci8_fetch(oci8_statement *statement, ub4 nrows, char *func) { sword error; + int i; + oci8_out_column *column; + pval *pval; OCI8_TLS_VARS; error = OCIStmtFetch(statement->pStmt, statement->pError, nrows, OCI_FETCH_NEXT, OCI_DEFAULT); if (error == OCI_NO_DATA) { return 0; } + if (error == OCI_SUCCESS_WITH_INFO || error == OCI_SUCCESS) { + for (i = 0; i < statement->ncolumns; i++) { + column = oci8_get_col(statement, i + 1, 0, "OCIFetch"); + if (column == NULL) { /* should not happen... */ + continue; + } + + if (column->define) { + pval = column->define->pval; + + pval->value.str.len = strlen(pval->value.str.val); + pval->value.str.val[ pval->value.str.len ] = 0; + } + } + return 1; } oci8_error(statement->pError, func, error); + return 0; } *************** *** 1131,1148 **** php3_error(E_WARNING, "!phpbind || !phpbind->val"); return OCI_ERROR; } - - #if dontneed - if (val->type == IS_STRING && val->value.str.val == undefined_variable_string) { - /* NULL value */ - phpbind->indicator = -1; - phpbind->maxsize = 0; - } else { - convert_to_string(val); /* XXX FIXME should make a copy instead */ - phpbind->indicator = 0; - phpbind->maxsize = val->value.str.len + 1; - } - #endif if (phpbind->descr == 0) { /* "normal string bind */ convert_to_string(val); --- 1151,1156 ---- Index: php3/functions/php3_oci8.h diff -c php3/functions/php3_oci8.h:1.27 php3/functions/php3_oci8.h:1.28 *** php3/functions/php3_oci8.h:1.27 Tue Feb 16 09:55:22 1999 --- php3/functions/php3_oci8.h Thu Feb 18 08:06:03 1999 *************** *** 117,122 **** --- 117,123 ---- ub2 is_descr; int descr; void *data; + oci8_define *define; } oci8_out_column; typedef struct { -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#4142) next »