[PHP-CVS] cvs: php-src(PHP_5_3) /ext/oci8 oci8_statement.c /ext/oci8/tests bug46994.phpt

2009-03-11 Thread Christopher Jones
sixdWed Mar 11 16:47:14 2009 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/oci8/tests bug46994.phpt 

  Modified files:  
/php-src/ext/oci8   oci8_statement.c 
  Log:
  MFH: Bug #46994 (CLOB size does not update when using CLOB IN OUT param in 
stored procedure)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8_statement.c?r1=1.7.2.14.2.28.2.12&r2=1.7.2.14.2.28.2.13&diff_format=u
Index: php-src/ext/oci8/oci8_statement.c
diff -u php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.28.2.12 
php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.28.2.13
--- php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.28.2.12Mon Mar  9 
20:58:51 2009
+++ php-src/ext/oci8/oci8_statement.c   Wed Mar 11 16:47:14 2009
@@ -25,7 +25,7 @@
+--+
 */
 
-/* $Id: oci8_statement.c,v 1.7.2.14.2.28.2.12 2009/03/09 20:58:51 sixd Exp $ */
+/* $Id: oci8_statement.c,v 1.7.2.14.2.28.2.13 2009/03/11 16:47:14 sixd Exp $ */
 
 
 #ifdef HAVE_CONFIG_H
@@ -1159,9 +1159,24 @@
}
retval = OCI_CONTINUE;
} else if (Z_TYPE_P(val) == IS_OBJECT) {
+   zval **tmp;
+   php_oci_descriptor *desc;
+
if (!phpbind->descriptor) {
return OCI_ERROR;
}
+
+   /* Do not use the cached lob size if the descriptor is an
+* out-bind as the contents would have been changed for in/out
+* binds (Bug #46994).
+*/
+   if (zend_hash_find(Z_OBJPROP_P(val), "descriptor", 
sizeof("descriptor"), (void **)&tmp) == FAILURE) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to 
find object outbind descriptor property");
+   return OCI_ERROR;
+   }
+   PHP_OCI_ZVAL_TO_DESCRIPTOR_EX(*tmp, desc);
+   desc->lob_size = -1;/* force OCI8 to update cached size */
+
*alenpp = &phpbind->dummy_len;
*bufpp = phpbind->descriptor;
*piecep = OCI_ONE_PIECE;

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/bug46994.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/bug46994.phpt
+++ php-src/ext/oci8/tests/bug46994.phpt
--TEST--
Bug #46994 (CLOB size does not update when using CLOB IN OUT param in stored 
procedure)
--SKIPIF--

--FILE--
writeTemporary("some data", OCI_TEMP_CLOB);

echo "Test 1\n";

$s = oci_parse($c, "begin bug46994_proc1(:myclob); end;");
oci_bind_by_name($s, ":myclob", $myclob, -1, SQLT_CLOB);
oci_execute($s, OCI_DEFAULT);
var_dump($myclob->load());

echo "Test 2\n";

$s = oci_parse($c, "begin bug46994_proc2(:myclob); end;");
oci_bind_by_name($s, ":myclob", $myclob, -1, SQLT_CLOB);
oci_execute($s, OCI_DEFAULT);
var_dump($myclob->load());

echo "Test 3\n";

$s = oci_parse($c, "begin bug46994_proc1(:myclob); end;");
oci_bind_by_name($s, ":myclob", $myclob, -1, SQLT_CLOB);
oci_execute($s, OCI_DEFAULT);
var_dump($myclob->load());

echo "Test 4\n";

var_dump($myclob->load());  // Use cached size code path

// Cleanup

$stmtarray = array(
"drop procedure bug46994_proc1",
"drop procedure bug46994_proc2"
);

foreach ($stmtarray as $stmt) {
$s = oci_parse($c, $stmt);
oci_execute($s);
}

oci_close($c);

?>
===DONE===

--EXPECTF--
Test 1
unicode(26) "This should be the output."
Test 2
unicode(37) "The output should be even longer now."
Test 3
unicode(26) "This should be the output."
Test 4
unicode(26) "This should be the output."
===DONE===



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/oci8 oci8_statement.c php_oci8_int.h

2009-03-09 Thread Christopher Jones
sixdMon Mar  9 20:58:51 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/oci8   php_oci8_int.h oci8_statement.c 
  Log:
  MFH: Make non-public prototype match the type passed at call
  
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/php_oci8_int.h?r1=1.11.2.6.2.21.2.13&r2=1.11.2.6.2.21.2.14&diff_format=u
Index: php-src/ext/oci8/php_oci8_int.h
diff -u php-src/ext/oci8/php_oci8_int.h:1.11.2.6.2.21.2.13 
php-src/ext/oci8/php_oci8_int.h:1.11.2.6.2.21.2.14
--- php-src/ext/oci8/php_oci8_int.h:1.11.2.6.2.21.2.13  Mon Mar  9 20:09:07 2009
+++ php-src/ext/oci8/php_oci8_int.h Mon Mar  9 20:58:51 2009
@@ -25,7 +25,7 @@
+--+
 */
 
-/* $Id: php_oci8_int.h,v 1.11.2.6.2.21.2.13 2009/03/09 20:09:07 sixd Exp $ */
+/* $Id: php_oci8_int.h,v 1.11.2.6.2.21.2.14 2009/03/09 20:58:51 sixd Exp $ */
 
 #if HAVE_OCI8
 # ifndef PHP_OCI8_INT_H
@@ -441,7 +441,7 @@
 void php_oci_statement_free (php_oci_statement * TSRMLS_DC);
 int php_oci_bind_pre_exec(void *data TSRMLS_DC);
 int php_oci_bind_post_exec(void *data TSRMLS_DC);
-int php_oci_bind_by_name(php_oci_statement *, char *, int, zval*, long, long 
TSRMLS_DC);
+int php_oci_bind_by_name(php_oci_statement *, char *, int, zval*, long, ub2 
TSRMLS_DC);
 sb4 php_oci_bind_in_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 *, 
ub1 *, dvoid **);
 sb4 php_oci_bind_out_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 **, 
ub1 *, dvoid **, ub2 **);
 php_oci_out_column 
*php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int 
need_data);
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8_statement.c?r1=1.7.2.14.2.28.2.11&r2=1.7.2.14.2.28.2.12&diff_format=u
Index: php-src/ext/oci8/oci8_statement.c
diff -u php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.28.2.11 
php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.28.2.12
--- php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.28.2.11Wed Dec 31 
11:15:39 2008
+++ php-src/ext/oci8/oci8_statement.c   Mon Mar  9 20:58:51 2009
@@ -25,7 +25,7 @@
+--+
 */
 
-/* $Id: oci8_statement.c,v 1.7.2.14.2.28.2.11 2008/12/31 11:15:39 sebastian 
Exp $ */
+/* $Id: oci8_statement.c,v 1.7.2.14.2.28.2.12 2009/03/09 20:58:51 sixd Exp $ */
 
 
 #ifdef HAVE_CONFIG_H
@@ -883,7 +883,7 @@
 
 /* {{{ php_oci_bind_by_name()
  Bind zval to the given placeholder */
-int php_oci_bind_by_name(php_oci_statement *statement, char *name, int 
name_len, zval* var, long maxlength, long type TSRMLS_DC)
+int php_oci_bind_by_name(php_oci_statement *statement, char *name, int 
name_len, zval* var, long maxlength, ub2 type TSRMLS_DC)
 {
php_oci_collection *bind_collection = NULL;
php_oci_descriptor *bind_descriptor = NULL;
@@ -975,7 +975,7 @@
break;
 
default:
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or 
unsupported datatype given: %ld", type);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or 
unsupported datatype given: %d", (int)type);
return 1;
break;
}
@@ -1008,14 +1008,14 @@
PHP_OCI_CALL_RETURN(statement->errcode,
OCIBindByName,
(
-   statement->stmt,/* 
statement handle */
-   (OCIBind **)&bindp->bind,   /* bind hdl 
(will alloc) */
-   statement->err,   /* error 
handle */
+   statement->stmt, /* 
statement handle */
+   (OCIBind **)&bindp->bind,/* bind hdl 
(will alloc) */
+   statement->err,  /* 
error handle */
(text*) name,/* 
placeholder name */ 
name_len,   
 /* placeholder length */
(dvoid *)bind_data,  /* 
in/out data */
value_sz, /* PHP_OCI_MAX_DATA_SIZE, */ /* max size of 
input/output data */
-   (ub2)type,  
 /* in/out data type */
+   type,   
 /* in/out data type */
(dvoid *)&bindp->indicator,  /* indicator 
(ignored) */
(ub2 *)0,   
 /* size array (ignored) */
(ub2 *)&bindp->retcode,  /* return code 
(ignored) */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/oci8 oci8_statement.c

2008-03-25 Thread Christopher Jones
sixdTue Mar 25 17:38:07 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/oci8   oci8_statement.c 
  Log:
  revert stmt release on connection error change (and sync with PHP 6)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8_statement.c?r1=1.7.2.14.2.28.2.6&r2=1.7.2.14.2.28.2.7&diff_format=u
Index: php-src/ext/oci8/oci8_statement.c
diff -u php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.28.2.6 
php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.28.2.7
--- php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.28.2.6 Sat Mar 22 01:27:50 2008
+++ php-src/ext/oci8/oci8_statement.c   Tue Mar 25 17:38:07 2008
@@ -25,7 +25,7 @@
+--+
 */
 
-/* $Id: oci8_statement.c,v 1.7.2.14.2.28.2.6 2008/03/22 01:27:50 sixd Exp $ */
+/* $Id: oci8_statement.c,v 1.7.2.14.2.28.2.7 2008/03/25 17:38:07 sixd Exp $ */
 
 
 #ifdef HAVE_CONFIG_H
@@ -82,7 +82,7 @@
connection->errcode = php_oci_error(connection->err, 
connection->errcode TSRMLS_CC);
 
 #if HAVE_OCI_STMT_PREPARE2
-   PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, 
statement->err, NULL, 0, OCI_STRLS_CACHE_DELETE));
+   PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, 
statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : 
OCI_DEFAULT));
PHP_OCI_CALL(OCIHandleFree,(statement->err, 
OCI_HTYPE_ERROR));
 #else
PHP_OCI_CALL(OCIHandleFree,(statement->stmt, 
OCI_HTYPE_STMT));



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/oci8 oci8_statement.c /ext/oci8/tests bind_char_1.phpt bind_char_2.phpt bind_char_3.phpt bind_char_4.phpt bug41069.phpt

2008-03-04 Thread Christopher Jones
sixdTue Mar  4 21:46:24 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/oci8/tests bind_char_1.phpt bind_char_2.phpt 
bind_char_3.phpt bind_char_4.phpt 
bug41069.phpt 

  Modified files:  
/php-src/ext/oci8   oci8_statement.c 
  Log:
  MFH Fix bug #41069 (db link crash).  Also allow SQLT_AFC (aka CHAR datatype) 
in oci_bind_by_name
  http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8_statement.c?r1=1.7.2.14.2.28.2.4&r2=1.7.2.14.2.28.2.5&diff_format=u
Index: php-src/ext/oci8/oci8_statement.c
diff -u php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.28.2.4 
php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.28.2.5
--- php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.28.2.4 Mon Feb 25 23:50:51 2008
+++ php-src/ext/oci8/oci8_statement.c   Tue Mar  4 21:46:24 2008
@@ -25,7 +25,7 @@
+--+
 */
 
-/* $Id: oci8_statement.c,v 1.7.2.14.2.28.2.4 2008/02/25 23:50:51 sixd Exp $ */
+/* $Id: oci8_statement.c,v 1.7.2.14.2.28.2.5 2008/03/04 21:46:24 sixd Exp $ */
 
 
 #ifdef HAVE_CONFIG_H
@@ -125,22 +125,13 @@
  Set prefetch buffer size for the statement (we're assuming that one row is 
~1K sized) */
 int php_oci_statement_set_prefetch(php_oci_statement *statement, long size 
TSRMLS_DC)
 { 
-   ub4 prefetch = size * 1024;
+   ub4 prefetch = size;
 
if (size < 1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of rows has 
to be greater than or equal to 1");
return 1;
}

-   PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrSet, (statement->stmt, 
OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_MEMORY, statement->err));
-
-   if (statement->errcode != OCI_SUCCESS) {
-   php_oci_error(statement->err, statement->errcode TSRMLS_CC);
-   PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
-   return 1;
-   }
-
-   prefetch = size;
PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrSet, (statement->stmt, 
OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, statement->err));

if (statement->errcode != OCI_SUCCESS) {
@@ -975,8 +966,8 @@
case SQLT_LBI:
case SQLT_BIN:
case SQLT_LNG:
-   case SQLT_CHR:
-   /* this is the default case when type was not specified 
*/
+   case SQLT_AFC:
+   case SQLT_CHR: /* SQLT_CHR is the default value when type was 
not specified */
if (Z_TYPE_P(var) != IS_NULL) {
convert_to_string(var);
}

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/bind_char_1.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/bind_char_1.phpt
+++ php-src/ext/oci8/tests/bind_char_1.phpt
--TEST--
SELECT oci_bind_by_name with SQLT_AFC aka CHAR
--SKIPIF--

--FILE--

--EXPECT--
*** Non-null Data Tests against CHAR***
Test 1.1: Type: default.  Length: default
  Querying:
Test 1.2: Type: AFC.  Length: default
  Querying:
:1:
:abc   :
::
Test 1.3: Type: AFC:  Length: 0
  Querying:
Oci_execute error ORA-1460 Exiting Query
Test 1.4: Type: AFC:  Length: strlen
  Querying:
:1:
:abc   :
::
Test 1.5: Type: AFC.  Length: strlen-1
  Querying:
Oci_execute error ORA-1460 Exiting Query
Test 1.6: Type: AFC.  Length: strlen+1
  Querying:
:1:
:abc   :
::


*** NULL data tests against CHAR ***
Test 2.1: Type: default.  Length: default
  Querying:
Test 2.2: Type: AFC.  Length: default
  Querying:
Test 2.3: Type: AFC:  Length: 0
  Querying:
Test 2.4: Type: AFC:  Length: strlen
  Querying:
Test 2.5: Type: AFC.  Length: strlen-1
  Querying:
Test 2.6: Type: AFC.  Length: strlen+1
  Querying:


*** Non-null Data Tests against VARCHAR2***
Test 3.1: Type: default.  Length: default
  Querying:
:2:
::
:abc:
Test 3.2: Type: AFC.  Length: default
  Querying:
:2:
::
:abc:
Test 3.3: Type: AFC:  Length: 0
  Querying:
Oci_execute error ORA-1460 Exiting Query
Test 3.4: Type: AFC:  Length: strlen
  Querying:
:2:
::
:abc:
Test 3.5: Type: AFC.  Length: strlen-1
  Querying:
Oci_execute error ORA-1460 Exiting Query
Test 3.6: Type: AFC.  Length: strlen+1
  Querying:
:2:
::
:abc:


*** NULL data tests against VARCHAR2 ***
Test 4.1: Type: default.  Length: default
  Querying:
Test 4.2: Type: AFC.  Length: default
  Querying:
Test 4.3: Type: AFC:  Length: 0
  Querying:
Test 4.4: Type: AFC:  Length: strlen
  Querying:
Test 4.5: Type: AFC.  Length: strlen-1
  Querying:
Test 4.6: Type: AFC.  Length: strlen+1
  Querying:
Done
--UEXPECT--
*** Non-null Data Tests against CHAR***
Test 1.1: Type: default.  Length: default
  Querying:
Test 1.2: Type: AFC.  Length: default
  Querying:
:1:
:abc   :
::
Test 1.3: Type: AFC:  Length: 0
  Querying

Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/oci8 oci8_statement.c /ext/oci8/tests bug42496_1.phpt bug42496_2.phpt lob_041.phpt

2007-12-11 Thread Antony Dovgal
On 11.12.2007 09:46, Christopher Jones wrote:
> sixd  Tue Dec 11 06:46:16 2007 UTC
> 
>   Added files: (Branch: PHP_5_3)
> /php-src/ext/oci8/tests   lob_041.phpt bug42496_2.phpt 
>   bug42496_1.phpt 
> 
>   Modified files:  
> /php-src/ext/oci8 oci8_statement.c 
>   Log:
>   MFB: Fix #42496. Cursor leak fetching LOBs

Thanks, Chris!

-- 
Wbr, 
Antony Dovgal

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/oci8 oci8_statement.c /ext/oci8/tests bug42496_1.phpt bug42496_2.phpt lob_041.phpt

2007-12-10 Thread Christopher Jones
sixdTue Dec 11 06:46:16 2007 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/oci8/tests lob_041.phpt bug42496_2.phpt 
bug42496_1.phpt 

  Modified files:  
/php-src/ext/oci8   oci8_statement.c 
  Log:
  MFB: Fix #42496. Cursor leak fetching LOBs
  
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8_statement.c?r1=1.7.2.14.2.28&r2=1.7.2.14.2.28.2.1&diff_format=u
Index: php-src/ext/oci8/oci8_statement.c
diff -u php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.28 
php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.28.2.1
--- php-src/ext/oci8/oci8_statement.c:1.7.2.14.2.28 Thu Aug  2 19:04:37 2007
+++ php-src/ext/oci8/oci8_statement.c   Tue Dec 11 06:46:16 2007
@@ -25,7 +25,7 @@
+--+
 */
 
-/* $Id: oci8_statement.c,v 1.7.2.14.2.28 2007/08/02 19:04:37 sixd Exp $ */
+/* $Id: oci8_statement.c,v 1.7.2.14.2.28.2.1 2007/12/11 06:46:16 sixd Exp $ */
 
 
 #ifdef HAVE_CONFIG_H
@@ -368,7 +368,6 @@
if (!descr) {
return OCI_ERROR;
}
-   zend_list_addref(outcol->statement->id);
outcol->descid = descr->id;
descr->charset_form = outcol->charset_form;


http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/lob_041.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/lob_041.phpt
+++ php-src/ext/oci8/tests/lob_041.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/bug42496_2.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/bug42496_2.phpt
+++ php-src/ext/oci8/tests/bug42496_2.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/bug42496_1.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/bug42496_1.phpt
+++ php-src/ext/oci8/tests/bug42496_1.phpt

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php