tony2001 Thu Nov 23 15:23:10 2006 UTC
Modified files:
/php-src/ext/oci8 oci8_statement.c
/php-src/ext/oci8/tests array_bind_001.phpt array_bind_003.phpt
array_bind_date1.phpt array_bind_date.phpt
Log:
fix oci_bind_array_by_name() with SQLT_ODT type
fix tests
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8_statement.c?r1=1.36&r2=1.37&diff_format=u
Index: php-src/ext/oci8/oci8_statement.c
diff -u php-src/ext/oci8/oci8_statement.c:1.36
php-src/ext/oci8/oci8_statement.c:1.37
--- php-src/ext/oci8/oci8_statement.c:1.36 Thu Nov 23 14:20:59 2006
+++ php-src/ext/oci8/oci8_statement.c Thu Nov 23 15:23:10 2006
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_statement.c,v 1.36 2006/11/23 14:20:59 tony2001 Exp $ */
+/* $Id: oci8_statement.c,v 1.37 2006/11/23 15:23:10 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
@@ -802,7 +802,7 @@
} else {
zstr tmp;
tmp.s = buff;
- ZVAL_TEXTL(*entry, tmp,
buff_len, 1);
+ ZVAL_TEXTL(*entry, tmp,
TEXT_CHARS(buff_len), 1);
}
zend_hash_move_forward(hash);
} else {
@@ -813,7 +813,7 @@
php_oci_error(connection->err, connection->errcode TSRMLS_CC);
add_next_index_null(bind->zval);
} else {
-
add_next_index_textl(bind->zval, tmp, buff_len, 1);
+
add_next_index_textl(bind->zval, tmp, TEXT_CHARS(buff_len), 1);
}
}
}
@@ -1523,8 +1523,12 @@
}
if ((i < bind->array.current_length) &&
(zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
- convert_to_string_ex(entry);
- PHP_OCI_CALL_RETURN(connection->errcode,
OCIDateFromText, (connection->err, Z_STRVAL_PP(entry), Z_STRLEN_PP(entry),
NULL, 0, NULL, 0, &oci_date));
+ convert_to_text_ex(entry);
+ if (UG(unicode)) {
+ PHP_OCI_CALL_RETURN(connection->errcode,
OCIDateFromText, (connection->err, (text *)Z_UNIVAL_PP(entry).s,
UBYTES(Z_UNILEN_PP(entry)), NULL, 0, NULL, 0, &oci_date));
+ } else {
+ PHP_OCI_CALL_RETURN(connection->errcode,
OCIDateFromText, (connection->err, Z_STRVAL_PP(entry), Z_STRLEN_PP(entry),
NULL, 0, NULL, 0, &oci_date));
+ }
if (connection->errcode != OCI_SUCCESS) {
/* failed to convert string to date */
@@ -1538,7 +1542,14 @@
((OCIDate *)bind->array.elements)[i] = oci_date;
zend_hash_move_forward(hash);
} else {
- PHP_OCI_CALL_RETURN(connection->errcode,
OCIDateFromText, (connection->err, "01-JAN-00", sizeof("01-JAN-00")-1, NULL, 0,
NULL, 0, &oci_date));
+
+ if (UG(unicode)) {
+ UChar *tmp = USTR_MAKE("01-JAN-00");
+ PHP_OCI_CALL_RETURN(connection->errcode,
OCIDateFromText, (connection->err, (text *)tmp, UBYTES(sizeof("01-JAN-00")-1),
NULL, 0, NULL, 0, &oci_date));
+ efree(tmp);
+ } else {
+ PHP_OCI_CALL_RETURN(connection->errcode,
OCIDateFromText, (connection->err, "01-JAN-00", sizeof("01-JAN-00")-1, NULL, 0,
NULL, 0, &oci_date));
+ }
if (connection->errcode != OCI_SUCCESS) {
/* failed to convert string to date */
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/array_bind_001.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/oci8/tests/array_bind_001.phpt
diff -u php-src/ext/oci8/tests/array_bind_001.phpt:1.2
php-src/ext/oci8/tests/array_bind_001.phpt:1.3
--- php-src/ext/oci8/tests/array_bind_001.phpt:1.2 Thu Dec 8 22:31:55 2005
+++ php-src/ext/oci8/tests/array_bind_001.phpt Thu Nov 23 15:23:10 2006
@@ -67,3 +67,12 @@
string(0) ""
}
Done
+--UEXPECTF--
+Warning: oci_bind_array_by_name(): OCI-21560: argument 3 is null, invalid, or
out of range in %s on line %d
+
+Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
+array(1) {
+ [0]=>
+ unicode(0) ""
+}
+Done
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/array_bind_003.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/oci8/tests/array_bind_003.phpt
diff -u php-src/ext/oci8/tests/array_bind_003.phpt:1.2
php-src/ext/oci8/tests/array_bind_003.phpt:1.3
--- php-src/ext/oci8/tests/array_bind_003.phpt:1.2 Thu Dec 8 22:31:55 2005
+++ php-src/ext/oci8/tests/array_bind_003.phpt Thu Nov 23 15:23:10 2006
@@ -71,3 +71,16 @@
string(9) "26-OCT-17"
}
Done
+--UEXPECTF--
+Warning: oci_execute(): OCI_NO_DATA in %s on line %d
+array(4) {
+ [0]=>
+ unicode(9) "06-DEC-05"
+ [1]=>
+ unicode(9) "10-DEC-80"
+ [2]=>
+ unicode(9) "21-AUG-91"
+ [3]=>
+ unicode(9) "26-OCT-17"
+}
+Done
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/array_bind_date1.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/oci8/tests/array_bind_date1.phpt
diff -u php-src/ext/oci8/tests/array_bind_date1.phpt:1.2
php-src/ext/oci8/tests/array_bind_date1.phpt:1.3
--- php-src/ext/oci8/tests/array_bind_date1.phpt:1.2 Thu Dec 8 22:31:55 2005
+++ php-src/ext/oci8/tests/array_bind_date1.phpt Thu Nov 23 15:23:10 2006
@@ -72,3 +72,17 @@
string(9) "06-DEC-05"
}
Done
+--UEXPECT--
+array(5) {
+ [0]=>
+ unicode(9) "05-NOV-05"
+ [1]=>
+ unicode(9) "26-OCT-17"
+ [2]=>
+ unicode(9) "21-AUG-91"
+ [3]=>
+ unicode(9) "10-DEC-80"
+ [4]=>
+ unicode(9) "06-DEC-05"
+}
+Done
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/array_bind_date.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/oci8/tests/array_bind_date.phpt
diff -u php-src/ext/oci8/tests/array_bind_date.phpt:1.1
php-src/ext/oci8/tests/array_bind_date.phpt:1.2
--- php-src/ext/oci8/tests/array_bind_date.phpt:1.1 Tue Dec 6 19:15:02 2005
+++ php-src/ext/oci8/tests/array_bind_date.phpt Thu Nov 23 15:23:10 2006
@@ -72,3 +72,17 @@
string(9) "06-DEC-05"
}
Done
+--UEXPECT--
+array(5) {
+ [0]=>
+ unicode(9) "05-NOV-05"
+ [1]=>
+ unicode(9) "26-OCT-17"
+ [2]=>
+ unicode(9) "21-AUG-91"
+ [3]=>
+ unicode(9) "10-DEC-80"
+ [4]=>
+ unicode(9) "06-DEC-05"
+}
+Done
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php