CVS update: php3/functions

From: Date: Tue, 16 Feb 1999 11:57:52 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-4118@lists.php.net to get a copy of this message
Date: Tuesday February 16, 1999 @ 6:57 Author: thies Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv6448/functions Modified Files: oci8.c php3_oci8.h Log Message: support for ROWID datatype! support for RAW (RAW & LONG RAW are still limited to 64K) Index: php3/functions/oci8.c diff -c php3/functions/oci8.c:1.47 php3/functions/oci8.c:1.48 *** php3/functions/oci8.c:1.47 Mon Feb 15 11:32:40 1999 --- php3/functions/oci8.c Tue Feb 16 06:57:51 1999 *************** *** 32,38 **** +----------------------------------------------------------------------+ */ ! /* $Id: oci8.c,v 1.47 1999/02/15 16:32:40 thies Exp $ */ #include "php.h" #include "internal_functions.h" --- 32,38 ---- +----------------------------------------------------------------------+ */ ! /* $Id: oci8.c,v 1.48 1999/02/16 11:57:51 thies Exp $ */ #include "php.h" #include "internal_functions.h" *************** *** 64,69 **** --- 64,70 ---- * - make_pval needs some cleanup.... * - persistend connections * - NULLS (retcode/indicator) needs some more work for describing & binding + * - remove all XXXs */ /* {{{ thread safety stuff */ *************** *** 298,303 **** --- 299,305 ---- REGISTER_LONG_CONSTANT("SQLT_CFILEE",SQLT_CFILEE, CONST_CS | CONST_PERSISTENT); 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("SQLT_RDD",SQLT_RDD, CONST_CS | CONST_PERSISTENT); /* for OCIFetchInto & OCIResult */ REGISTER_LONG_CONSTANT("OCI_ASSOC",OCI_ASSOC, CONST_CS | CONST_PERSISTENT); *************** *** 457,465 **** { OCI8_TLS_VARS; ! oci8_debug("oci8_free_descr: %x",descr->lob); ! OCIDescriptorFree(descr->lob, descr->type); } /* }}} */ --- 459,467 ---- { OCI8_TLS_VARS; ! oci8_debug("oci8_free_descr: %x",descr->ocidescr); ! OCIDescriptorFree(descr->ocidescr, descr->type); } /* }}} */ *************** *** 672,678 **** statement = oci8_get_stmt(stmt_ind, "oci8_make_pval", list); if (column->is_descr) { ! if (mode & OCI_RETURN_LOBS) { /* OCI_RETURN_LOBS means that we want the content of the LOB back instead of the locator */ if (column->indicator == -1) { /* we hit a NULL value, return empty string or uninitialized value */ if (mode & OCI_RETURN_NULLS) { /* OCI_RETURN_NULLS means that we ALWAYS want to get "at least" an empty string */ --- 674,681 ---- statement = oci8_get_stmt(stmt_ind, "oci8_make_pval", list); if (column->is_descr) { ! if ((column->type =! SQLT_RDD) && (mode & OCI_RETURN_LOBS)) { ! /* OCI_RETURN_LOBS means that we want the content of the LOB back instead of the locator */ if (column->indicator == -1) { /* we hit a NULL value, return empty string or uninitialized value */ if (mode & OCI_RETURN_NULLS) { /* OCI_RETURN_NULLS means that we ALWAYS want to get "at least" an empty string */ *************** *** 707,714 **** add_property_long(value, "connection", statement->conn->id); add_property_long(value, "descriptor", (long) column->data); ! add_method(value, "save", php3_oci8_savelob); ! add_method(value, "load", php3_oci8_loadlob); } } else { switch (column->indicator) { --- 710,719 ---- add_property_long(value, "connection", statement->conn->id); add_property_long(value, "descriptor", (long) column->data); ! if (column->type =! SQLT_RDD) { ! add_method(value, "save", php3_oci8_savelob); ! add_method(value, "load", php3_oci8_loadlob); ! } } } else { switch (column->indicator) { *************** *** 870,875 **** --- 875,881 ---- * handled specially. */ switch (outcol->type) { + case SQLT_RDD: /* ROWID */ case SQLT_BLOB: /* binary LOB */ case SQLT_CLOB: /* character LOB */ case SQLT_BFILE: /* binary file LOB */ *************** *** 877,901 **** if (outcol->type == SQLT_BFILE) { descr.type = OCI_DTYPE_FILE; } else { descr.type = OCI_DTYPE_LOB; } ! OCIDescriptorAlloc(statement->conn->pEnv,(dvoid *)&(descr.lob), descr.type, (size_t) 0, (dvoid **) 0); _php3_hash_index_update(statement->conn->descriptors, statement->conn->descriptors_count,&descr,sizeof(oci8_descriptor),(void **)&pdescr); outcol->data = (void *)(void *) statement->conn->descriptors_count++; ! oci8_debug("OCIExecute: new descriptor for %d -> %x",outcol->data,descr.lob); define_type = outcol->type; def_error = OCIDefineByPos(statement->pStmt, (OCIDefine **)&outcol->pDefine, statement->pError, counter, ! (dvoid *)&(pdescr->lob), (sb4)-1, define_type, (dvoid *)&outcol->indicator, --- 883,909 ---- if (outcol->type == SQLT_BFILE) { descr.type = OCI_DTYPE_FILE; + } else if (outcol->type == SQLT_RDD ) { + descr.type = OCI_DTYPE_ROWID; } else { descr.type = OCI_DTYPE_LOB; } ! OCIDescriptorAlloc(statement->conn->pEnv,(dvoid *)&(descr.ocidescr), descr.type, (size_t) 0, (dvoid **) 0); _php3_hash_index_update(statement->conn->descriptors, statement->conn->descriptors_count,&descr,sizeof(oci8_descriptor),(void **)&pdescr); outcol->data = (void *)(void *) statement->conn->descriptors_count++; ! oci8_debug("OCIExecute: new descriptor for %d -> %x",outcol->data,descr.ocidescr); define_type = outcol->type; def_error = OCIDefineByPos(statement->pStmt, (OCIDefine **)&outcol->pDefine, statement->pError, counter, ! (dvoid *)&(pdescr->ocidescr), (sb4)-1, define_type, (dvoid *)&outcol->indicator, *************** *** 904,910 **** OCI_DEFAULT); break; - case SQLT_BIN: /* RAW */ case SQLT_RSET: /* ref. cursor */ /* XXX NYI */ define_type = outcol->type; --- 912,917 ---- *************** *** 914,920 **** default: define_type = SQLT_STR; ! if ((outcol->type == SQLT_LBI) || (outcol->type == SQLT_LNG)) { outcol->storage_size = (64*1024L)-1; /*XXX LONG fields should be done via callbacks!!! */ } else { outcol->storage_size++; /* add one for string terminator */ --- 921,927 ---- default: define_type = SQLT_STR; ! if ((outcol->type == SQLT_LBI) || (outcol->type == SQLT_LNG) || (outcol->type == SQLT_BIN)) { outcol->storage_size = (64*1024L)-1; /*XXX LONG fields should be done via callbacks!!! */ } else { outcol->storage_size++; /* add one for string terminator */ *************** *** 999,1005 **** OCI8_TLS_VARS; ! ociresult = OCILobGetLength(connection->pServiceContext, connection->pError, mydescr->lob, &loblen); if (ociresult) { oci8_error(connection->pError, "OCILobGetLength", ociresult); --- 1006,1012 ---- OCI8_TLS_VARS; ! ociresult = OCILobGetLength(connection->pServiceContext, connection->pError, mydescr->ocidescr, &loblen); if (ociresult) { oci8_error(connection->pError, "OCILobGetLength", ociresult); *************** *** 1015,1021 **** if (mydescr->type == OCI_DTYPE_FILE) { ociresult = OCILobFileOpen(connection->pServiceContext, connection->pError, ! mydescr->lob, OCI_FILE_READONLY); if (ociresult) { oci8_error(connection->pError, "OCILobRead: OCILobFileOpen", ociresult); --- 1022,1028 ---- if (mydescr->type == OCI_DTYPE_FILE) { ociresult = OCILobFileOpen(connection->pServiceContext, connection->pError, ! mydescr->ocidescr, OCI_FILE_READONLY); if (ociresult) { oci8_error(connection->pError, "OCILobRead: OCILobFileOpen", ociresult); *************** *** 1026,1032 **** ociresult = OCILobRead(connection->pServiceContext, connection->pError, ! mydescr->lob, &loblen, /* IN/OUT bytes toread/read */ 1, /* offset (starts with 1) */ (dvoid *) *buffer, --- 1033,1039 ---- ociresult = OCILobRead(connection->pServiceContext, connection->pError, ! mydescr->ocidescr, &loblen, /* IN/OUT bytes toread/read */ 1, /* offset (starts with 1) */ (dvoid *) *buffer, *************** *** 1045,1051 **** if (mydescr->type == OCI_DTYPE_FILE) { ociresult = OCILobFileClose(connection->pServiceContext, connection->pError, ! mydescr->lob); if (ociresult) { oci8_error(connection->pError, "OCILobRead: OCILobFileClose", ociresult); efree(buffer); --- 1052,1058 ---- if (mydescr->type == OCI_DTYPE_FILE) { ociresult = OCILobFileClose(connection->pServiceContext, connection->pError, ! mydescr->ocidescr); if (ociresult) { oci8_error(connection->pError, "OCILobRead: OCILobFileClose", ociresult); efree(buffer); *************** *** 1242,1248 **** RETURN_FALSE; } ! mydescr = (dvoid *) descr->lob; if (! mydescr) { RETURN_FALSE; --- 1249,1255 ---- RETURN_FALSE; } ! mydescr = (dvoid *) descr->ocidescr; if (! mydescr) { RETURN_FALSE; *************** *** 1388,1394 **** RETURN_FALSE; } ! mylob = (OCILobLocator *) descr->lob; if (! mylob) { RETURN_FALSE; --- 1395,1401 ---- RETURN_FALSE; } ! mylob = (OCILobLocator *) descr->ocidescr; if (! mylob) { RETURN_FALSE; *************** *** 1508,1514 **** RETURN_FALSE; } ! ociresult = OCIDescriptorAlloc(connection->pEnv,(dvoid*)&(descr.lob), descr.type, (size_t) 0, (dvoid **) 0); if (ociresult) { oci8_error(connection->pError,"OCIDescriptorAlloc %d",ociresult); --- 1515,1521 ---- RETURN_FALSE; } ! ociresult = OCIDescriptorAlloc(connection->pEnv,(dvoid*)&(descr.ocidescr), descr.type, (size_t) 0, (dvoid **) 0); if (ociresult) { oci8_error(connection->pError,"OCIDescriptorAlloc %d",ociresult); *************** *** 1519,1525 **** mylob = connection->descriptors_count++; ! oci8_debug("OCINewDescriptor: new descriptor for %d -> %x",mylob,descr.lob); object_init(return_value); add_property_long(return_value, "descriptor", (long) mylob); --- 1526,1532 ---- mylob = connection->descriptors_count++; ! oci8_debug("OCINewDescriptor: new descriptor for %d -> %x",mylob,descr.ocidescr); object_init(return_value); add_property_long(return_value, "descriptor", (long) mylob); *************** *** 1700,1705 **** --- 1707,1715 ---- break; case SQLT_BFILE: RETVAL_STRING("BFILE",1); + break; + case SQLT_RDD: + RETVAL_STRING("ROWID",1); break; default: RETVAL_LONG(outcol->type); Index: php3/functions/php3_oci8.h diff -c php3/functions/php3_oci8.h:1.25 php3/functions/php3_oci8.h:1.26 *** php3/functions/php3_oci8.h:1.25 Mon Feb 15 11:32:41 1999 --- php3/functions/php3_oci8.h Tue Feb 16 06:57:52 1999 *************** *** 70,76 **** } oci8_connection; typedef struct { ! OCILobLocator *lob; ub4 type; } oci8_descriptor; --- 70,76 ---- } oci8_connection; typedef struct { ! dvoid *ocidescr; ub4 type; } oci8_descriptor; -- 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 (#4118) next »