Patch proposal to implement `lob_type' as an optional parameter to the `ociwritetemporarylob' function.
Patch changes file ext/oci8/oci8.c, diff made against php-5 latest csl /* $Id: oci8.c,v 1.211 2003/06/22 14:33:03 andrey Exp $ */ * * * The function `ociwritetemporarylob' creates an oracle LOB object. Currently the type of object is set to OCI_TEMP_CLOB and there is no way how to create temporary BLOB. The enclosed patch defines two constants - types of temporary LOBs: OCI_TEMP_CLOB OCI_TEMP_BLOB and extends the number of parameters of function `ociwritetemporarylob' by an optional parameter LOB type (default value is set to OCI_TEMP_CLOB to preserve backward compatibility). Can someone check and commit this patch ? Thanks Marek --- Odchozí zpráva neobsahuje viry. Zkontrolováno antivirovým systémem AVG (http://www.grisoft.cz). Verze: 6.0.502 / Virová báze: 300 - datum vydání: 18.7.2003
--- oci8.c.orig 2003-07-21 16:12:36.000000000 +0200 +++ oci8.c 2003-07-21 11:56:39.000000000 +0200 @@ -560,6 +560,12 @@ REGISTER_LONG_CONSTANT("OCI_D_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("OCI_D_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); +/* for OCIWriteTemporaryLob */ +#ifdef HAVE_OCI8_TEMP_LOB + REGISTER_LONG_CONSTANT("OCI_TEMP_CLOB",OCI_TEMP_CLOB, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OCI_TEMP_BLOB",OCI_TEMP_BLOB, CONST_CS | CONST_PERSISTENT); +#endif + return SUCCESS; } @@ -3432,17 +3438,18 @@ /* }}} */ #ifdef HAVE_OCI8_TEMP_LOB -/* {{{ proto bool ociwritetemporarylob(string var) +/* {{{ proto bool ociwritetemporarylob(string var [, int lob_type]) Writes temporary blob */ PHP_FUNCTION(ociwritetemporarylob) { - zval *id, **var; + zval *id, *var; OCILobLocator *mylob; oci_connection *connection; oci_descriptor *descr; ub4 offset = 1; ub4 loblen; + int lob_type = OCI_TEMP_CLOB; oci_debug ("oci_write_temporary_lob"); @@ -3462,11 +3469,10 @@ connection = descr->conn; - if (zend_get_parameters_ex(1, &var) == FAILURE) { - WRONG_PARAM_COUNT; + if (ZEND_NUM_ARGS() < 1) WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &var, &lob_type) == FAILURE) { + RETURN_FALSE; } - /* is this convert needed - done again below */ - convert_to_string_ex(var); CALL_OCI_RETURN(connection->error, OCILobCreateTemporary( connection->pServiceContext, @@ -3474,7 +3480,7 @@ mylob, OCI_DEFAULT, OCI_DEFAULT, - OCI_TEMP_CLOB, + lob_type, OCI_ATTR_NOCACHE, OCI_DURATION_SESSION)); @@ -3496,8 +3502,8 @@ RETURN_FALSE; } - convert_to_string_ex(var); - loblen = Z_STRLEN_PP(var); + convert_to_string_ex(&var); + loblen = Z_STRLEN_P(var); if (loblen < 1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot save a lob that is less than 1 byte"); @@ -3510,7 +3516,7 @@ mylob, (ub4 *) &loblen, (ub4) offset, - (dvoid *) Z_STRVAL_PP(var), + (dvoid *) Z_STRVAL_P(var), (ub4) loblen, OCI_ONE_PIECE, (dvoid *)0,
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php