cvs: /php4 ChangeLog /php4/ext/oci8 oci8.c

From: Date: Tue, 14 Sep 1999 12:41:02 +0000
Subject: cvs: /php4 ChangeLog /php4/ext/oci8 oci8.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-4422@lists.php.net to get a copy of this message
thies Tue Sep 14 08:41:02 1999 EDT Modified files: /php4 ChangeLog /php4/ext/oci8 oci8.c Log: you can now position when doing lob-writes. Index: php4/ChangeLog diff -u php4/ChangeLog:1.101 php4/ChangeLog:1.102 --- php4/ChangeLog:1.101 Mon Sep 13 11:48:32 1999 +++ php4/ChangeLog Tue Sep 14 08:40:59 1999 @@ -2,6 +2,7 @@ ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ?? 1999, Version 4.0 Beta 3 +- OCI8 supports appending and positioning when saving LOBs (Thies) - Added metaphone support (Thies) - OCI8 doesn't use define callbacks any longer. (Thies) - OCI8 Driver now supports LOBs like PHP3. (Thies) Index: php4/ext/oci8/oci8.c diff -u php4/ext/oci8/oci8.c:1.25 php4/ext/oci8/oci8.c:1.26 --- php4/ext/oci8/oci8.c:1.25 Mon Sep 13 11:19:28 1999 +++ php4/ext/oci8/oci8.c Tue Sep 14 08:41:00 1999 @@ -22,7 +22,7 @@ #define OCI_USE_EMALLOC 0 /* set this to 1 if you want to use the php memory manager! */ -/* $Id: oci8.c,v 1.25 1999/09/13 15:19:28 thies Exp $ */ +/* $Id: oci8.c,v 1.26 1999/09/14 12:41:00 thies Exp $ */ /* TODO list: * @@ -2400,11 +2400,14 @@ PHP_FUNCTION(ocisavelob) { - pval *id, **tmp, **conn, *arg; + pval *id, **tmp, **conn, *arg,*oarg; OCILobLocator *mylob; oci_connection *connection; oci_descriptor *descr; + int offparam; ub4 loblen; + ub4 curloblen; + ub4 offset; if ((id = getThis()) != 0) { if (zend_hash_find(id->value.obj.properties, "connection", sizeof("connection"), (void **)&conn) == FAILURE) { @@ -2433,32 +2436,54 @@ RETURN_FALSE; } - if (getParameters(ht, 1, &arg) == FAILURE) { + offset = 0; + if (getParameters(ht, 2, &arg, &oarg) == SUCCESS) { + convert_to_long(oarg); + offparam = oarg->value.lval; + + connection->error = + OCILobGetLength(connection->pServiceContext, + connection->pError, + mylob, + &curloblen); + + oci_debug("OCIsavedesc: curloblen=%d",curloblen); + + if (offparam == -1) { + offset = curloblen; + } else if (offparam >= curloblen) { + php3_error(E_WARNING, "Offset smaller than current LOB-Size - appending"); + offset = curloblen; + } else { + offset = offparam; + } + } else if (getParameters(ht, 1, &arg) == FAILURE) { WRONG_PARAM_COUNT; } + offset++; loblen = arg->value.str.len; if (loblen < 1) { - php_error(E_WARNING, "Cannot save a lob wich size is less than 1 byte"); + php3_error(E_WARNING, "Cannot save a lob wich size is less than 1 byte"); RETURN_FALSE; } - + connection->error = OCILobWrite(connection->pServiceContext, - connection->pError, - mylob, - &loblen, - (ub4) 1, - (dvoid *) arg->value.str.val, - (ub4) loblen, - OCI_ONE_PIECE, - (dvoid *)0, - (OCICallbackLobWrite) 0, - (ub2) 0, - (ub1) SQLCS_IMPLICIT ); + connection->pError, + mylob, + &loblen, + (ub4) offset, + (dvoid *) arg->value.str.val, + (ub4) loblen, + OCI_ONE_PIECE, + (dvoid *)0, + (OCICallbackLobWrite) 0, + (ub2) 0, + (ub1) SQLCS_IMPLICIT ); - oci_debug("OCIsavelob: size=%d",loblen); + oci_debug("OCIsavedesc: size=%d offset=%d",loblen,offset); if (connection->error) { oci_error(connection->pError, "OCILobWrite", connection->error);

« previous php.version4 (#4422) next »