CVS update: php3/functions

From: Date: Tue, 09 Feb 1999 11:45:02 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-4001@lists.php.net to get a copy of this message
Date: Tuesday February 9, 1999 @ 6:45 Author: thies Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv9222 Modified Files: oci8.c php3_oci8.h Log Message: added 3th optional parameter to ocifetchinto (OCI_NUM, OCI_ASSOC) - same as in mysql still looking for a few leaks;-) Index: php3/functions/oci8.c diff -c php3/functions/oci8.c:1.29 php3/functions/oci8.c:1.30 *** php3/functions/oci8.c:1.29 Mon Feb 8 11:54:22 1999 --- php3/functions/oci8.c Tue Feb 9 06:45:01 1999 *************** *** 32,38 **** +----------------------------------------------------------------------+ */ ! /* $Id: oci8.c,v 1.29 1999/02/08 16:54:22 thies Exp $ */ #include "php.h" #include "internal_functions.h" --- 32,38 ---- +----------------------------------------------------------------------+ */ ! /* $Id: oci8.c,v 1.30 1999/02/09 11:45:01 thies Exp $ */ #include "php.h" #include "internal_functions.h" *************** *** 177,182 **** --- 177,186 ---- static unsigned char refs_aaf[] = {3, BYREF_ALLOW, BYREF_ALLOW, BYREF_FORCE}; + #define OCI_ASSOC 1<<0 + #define OCI_NUM 1<<1 + #define OCI_BOTH (OCI_ASSOC|OCI_NUM) + function_entry oci8_functions[] = { {"ocibindbyname", php3_oci8_bindbyname, refs_aaf}, {"ocicolumnisnull", php3_oci8_columnisnull, NULL}, *************** *** 282,287 **** --- 286,295 ---- REGISTER_LONG_CONSTANT("SQLT_CLOB",SQLT_CLOB, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SQLT_BLOB",SQLT_BLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_ASSOC",OCI_ASSOC, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_NUM",OCI_NUM, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_BOTH",OCI_BOTH, CONST_CS | CONST_PERSISTENT); + return SUCCESS; } *************** *** 790,795 **** --- 798,804 ---- case SQLT_RSET: /* ref. cursor */ /* XXX NYI */ define_type = outcol->type; + def_error = -1; break; default: *************** *** 1608,1629 **** } /* }}} */ ! /* {{{ proto int OCIFetchInto(int stmt, array &output) Fetch a row of result data into an array. */ void php3_oci8_fetchinto(INTERNAL_FUNCTION_PARAMETERS) { ! pval *stmt, *array, *element; oci8_statement *statement; oci8_out_column *column; ub4 nrows = 1; int i; OCI8_TLS_VARS; ! if (getParameters(ht, 2, &stmt, &array) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long(stmt); statement = oci8_get_stmt(stmt->value.lval, "OCIFetchInto", list); if (statement == NULL) { --- 1617,1643 ---- } /* }}} */ ! /* {{{ proto int OCIFetchInto(int stmt, array &output [, int mode]) Fetch a row of result data into an array. */ void php3_oci8_fetchinto(INTERNAL_FUNCTION_PARAMETERS) { ! pval *stmt, *array, *element, *fmode; oci8_statement *statement; oci8_out_column *column; ub4 nrows = 1; int i; + int mode = OCI_NUM; OCI8_TLS_VARS; ! if (getParameters(ht, 3, &stmt, &array, &fmode) == SUCCESS) { ! convert_to_long(fmode); ! mode = fmode->value.lval; ! } else if (getParameters(ht, 2, &stmt, &array) == FAILURE) { WRONG_PARAM_COUNT; } + convert_to_long(stmt); statement = oci8_get_stmt(stmt->value.lval, "OCIFetchInto", list); if (statement == NULL) { *************** *** 1644,1653 **** column = oci8_get_col(statement, i + 1, "OCIFetchInto"); if (column == NULL || column->indicator == -1) { continue; } - element = oci8_make_pval(stmt->value.lval,column, "OCIFetchInto",list); - _php3_hash_index_update(array->value.ht, i, (void *)element, - sizeof(pval), NULL); } RETVAL_LONG(statement->ncolumns); } --- 1658,1675 ---- column = oci8_get_col(statement, i + 1, "OCIFetchInto"); if (column == NULL || column->indicator == -1) { continue; + } + + /* XXX i'm not sure if we need to duplicate the element */ + if (mode & OCI_NUM) { + element = oci8_make_pval(stmt->value.lval,column, "OCIFetchInto",list); + _php3_hash_index_update(array->value.ht, i, (void *)element, sizeof(pval), NULL); + } + + if (mode & OCI_ASSOC) { + element = oci8_make_pval(stmt->value.lval,column, "OCIFetchInto",list); + _php3_hash_update(array->value.ht, column->name, column->name_len, (void *)element, sizeof(pval), NULL); } } RETVAL_LONG(statement->ncolumns); } Index: php3/functions/php3_oci8.h diff -c php3/functions/php3_oci8.h:1.17 php3/functions/php3_oci8.h:1.18 *** php3/functions/php3_oci8.h:1.17 Mon Feb 8 08:35:52 1999 --- php3/functions/php3_oci8.h Tue Feb 9 06:45:02 1999 *************** *** 64,69 **** --- 64,73 ---- OCISvcCtx *pServiceContext; OCIError *pError; OCISession *pSession; + /* + HashTable *statements; + HashTable *descriptors; + */ int open; } oci8_connection; *************** *** 112,121 **** long num_persistent; long num_links; int le_conn; ! int le_descr; ! /* int le_pconn;*/ ! int le_stmt; ! /* sb4 max_bind_data_size; */ } oci8_module; extern php3_module_entry oci8_module_entry; --- 116,123 ---- long num_persistent; long num_links; int le_conn; ! int le_descr; ! int le_stmt; } oci8_module; extern php3_module_entry oci8_module_entry; -- 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 (#4001) next »