[PHP-CVS] cvs: php-src /ext/oci8 oci8_collection.c /ext/oci8/tests bug44113.phpt

2008-02-15 Thread Christopher Jones
sixdFri Feb 15 23:49:21 2008 UTC

  Modified files:  
/php-src/ext/oci8   oci8_collection.c 
/php-src/ext/oci8/tests bug44113.phpt 
  Log:
  MHB: Bug #44113 (New collection creation can fail with OCI-22303)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8_collection.c?r1=1.16r2=1.17diff_format=u
Index: php-src/ext/oci8/oci8_collection.c
diff -u php-src/ext/oci8/oci8_collection.c:1.16 
php-src/ext/oci8/oci8_collection.c:1.17
--- php-src/ext/oci8/oci8_collection.c:1.16 Mon Dec 31 07:12:12 2007
+++ php-src/ext/oci8/oci8_collection.c  Fri Feb 15 23:49:21 2008
@@ -25,7 +25,7 @@
+--+
 */
 
-/* $Id: oci8_collection.c,v 1.16 2007/12/31 07:12:12 sebastian Exp $ */
+/* $Id: oci8_collection.c,v 1.17 2008/02/15 23:49:21 sixd Exp $ */
 
 
 
@@ -44,9 +44,9 @@
 
 /* {{{ php_oci_collection_create() 
  Create and return connection handle */
-php_oci_collection * php_oci_collection_create(php_oci_connection* connection, 
zstr tdo, int tdo_len, zstr schema, int schema_len TSRMLS_DC)
+php_oci_collection * php_oci_collection_create(php_oci_connection *connection, 
zstr tdo, int tdo_len, zstr schema, int schema_len TSRMLS_DC)
 {  
-   dvoid *dschp1;
+   dvoid *dschp1 = NULL;
dvoid *parmp1;
dvoid *parmp2;
php_oci_collection *collection;
@@ -219,11 +219,17 @@
goto CLEANUP;
}
 
+   /* free the describe handle (Bug #44113) */
+   PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE));
PHP_OCI_REGISTER_RESOURCE(collection, le_collection);
return collection;

 CLEANUP:
 
+   if (dschp1) {
+   /* free the describe handle (Bug #44113) */
+   PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, 
OCI_HTYPE_DESCRIBE));
+   }
php_oci_error(connection-err, connection-errcode TSRMLS_CC);
php_oci_collection_close(collection TSRMLS_CC); 
return NULL;
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/bug44113.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/oci8/tests/bug44113.phpt
diff -u /dev/null php-src/ext/oci8/tests/bug44113.phpt:1.2
--- /dev/null   Fri Feb 15 23:49:21 2008
+++ php-src/ext/oci8/tests/bug44113.phptFri Feb 15 23:49:21 2008
@@ -0,0 +1,53 @@
+--TEST--
+Bug #44113 (New collection creation can fail with OCI-22303)
+--SKIPIF--
+?php if (!extension_loaded('oci8')) die (skip no oci8 extension); ?
+--FILE--
+?php
+
+require dirname(__FILE__).'/connect.inc';
+
+// Initialization
+
+$stmtarray = array(
+   create or replace type bug44113_list_t as table of number
+);
+
+foreach ($stmtarray as $stmt) {
+   $s = oci_parse($c, $stmt);
+   @oci_execute($s);
+}
+
+// Run Test
+// The test can take some time to complete and can exceed PHP's test
+// timout limit on slow networks.
+
+for ($x = 0; $x  7; $x++)
+{
+   if (!($var = oci_new_collection($c, 'BUG44113_LIST_T'))) {
+   print Failed new collection creation on $x\n;
+   break;
+   }
+}
+
+print Completed $x\n;
+
+// Cleanup
+
+$stmtarray = array(
+   drop type bug44113_list_t
+);
+
+foreach ($stmtarray as $stmt) {
+   $s = oci_parse($c, $stmt);
+   oci_execute($s);
+}
+
+oci_close($c);
+
+echo Done\n;
+
+?
+--EXPECT--
+Completed 7
+Done

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



[PHP-CVS] cvs: php-src /ext/oci8 oci8_collection.c

2007-03-28 Thread Antony Dovgal
tony2001Wed Mar 28 23:05:36 2007 UTC

  Modified files:  
/php-src/ext/oci8   oci8_collection.c 
  Log:
  Oracle seems to return non zero terminated strings or strings with only 1 
zero at the end in Unicode mode
  surely u_strlen() doesn't like it, so lets use OCIStringSize() and avoid 
u_strlen()
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8_collection.c?r1=1.12r2=1.13diff_format=u
Index: php-src/ext/oci8/oci8_collection.c
diff -u php-src/ext/oci8/oci8_collection.c:1.12 
php-src/ext/oci8/oci8_collection.c:1.13
--- php-src/ext/oci8/oci8_collection.c:1.12 Mon Jan  1 09:29:26 2007
+++ php-src/ext/oci8/oci8_collection.c  Wed Mar 28 23:05:36 2007
@@ -25,7 +25,7 @@
+--+
 */
 
-/* $Id: oci8_collection.c,v 1.12 2007/01/01 09:29:26 sebastian Exp $ */
+/* $Id: oci8_collection.c,v 1.13 2007/03/28 23:05:36 tony2001 Exp $ */
 
 
 
@@ -503,14 +503,17 @@
{
OCIString *oci_string = *(OCIString **)element;
text *str;
+   ub4 str_len;

PHP_OCI_CALL_RETURN(str, OCIStringPtr, 
(connection-env, oci_string));

if (str) {
+   PHP_OCI_CALL_RETURN(str_len, OCIStringSize, 
(connection-env, oci_string));
+
if (UG(unicode)) {
-   ZVAL_UNICODE(*result_element, (UChar 
*)str, 1);
+   ZVAL_UNICODEL(*result_element, (UChar 
*)str, TEXT_CHARS(str_len), 1);
} else { 
-   ZVAL_STRING(*result_element, str, 1);
+   ZVAL_STRINGL(*result_element, str, 
str_len, 1);
}
}
return 0;

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



[PHP-CVS] cvs: php-src /ext/oci8 oci8_collection.c

2006-05-30 Thread Antony Dovgal
tony2001Tue May 30 21:38:01 2006 UTC

  Modified files:  
/php-src/ext/oci8   oci8_collection.c 
  Log:
  fix compilation on some b0rked systems that must have collections support but 
they don't
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/oci8/oci8_collection.c?r1=1.6r2=1.7diff_format=u
Index: php-src/ext/oci8/oci8_collection.c
diff -u php-src/ext/oci8/oci8_collection.c:1.6 
php-src/ext/oci8/oci8_collection.c:1.7
--- php-src/ext/oci8/oci8_collection.c:1.6  Sun Jan  1 13:09:52 2006
+++ php-src/ext/oci8/oci8_collection.c  Tue May 30 21:38:00 2006
@@ -25,7 +25,7 @@
+--+
 */
 
-/* $Id: oci8_collection.c,v 1.6 2006/01/01 13:09:52 sniper Exp $ */
+/* $Id: oci8_collection.c,v 1.7 2006/05/30 21:38:00 tony2001 Exp $ */
 
 
 
@@ -37,7 +37,7 @@
 #include ext/standard/info.h
 #include php_ini.h
 
-#if HAVE_OCI8
+#if HAVE_OCI8  PHP_OCI8_HAVE_COLLECTIONS
 
 #include php_oci8.h
 #include php_oci8_int.h

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