diff options
| author | Thies C. Arntzen <thies@php.net> | 1999-09-14 12:41:00 +0000 |
|---|---|---|
| committer | Thies C. Arntzen <thies@php.net> | 1999-09-14 12:41:00 +0000 |
| commit | 598aaba8ca50901a4846d41be5cd89619894c5a9 (patch) | |
| tree | 59babafd970886a95e0b82812d2653b24782e5bf | |
| parent | 331221eec6000c8ced6163a1b241cb218f9c7ab9 (diff) | |
| download | php-git-598aaba8ca50901a4846d41be5cd89619894c5a9.tar.gz | |
you can now position when doing lob-writes.
| -rw-r--r-- | ChangeLog | 1 | ||||
| -rw-r--r-- | ext/oci8/oci8.c | 59 |
2 files changed, 43 insertions, 17 deletions
@@ -2,6 +2,7 @@ PHP 4.0 CHANGE LOG ChangeLog ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ?? 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) diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 76be8491f5..a8bc112b68 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -2400,11 +2400,14 @@ PHP_FUNCTION(ocifreedesc) 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 @@ PHP_FUNCTION(ocisavelob) 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 ); - - oci_debug("OCIsavelob: size=%d",loblen); + 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("OCIsavedesc: size=%d offset=%d",loblen,offset); if (connection->error) { oci_error(connection->pError, "OCILobWrite", connection->error); |
