sixd Thu Aug 2 19:04:37 2007 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/oci8/tests bug42173.phpt
Modified files:
/php-src/ext/oci8 oci8_statement.c oci8_interface.c
Log:
MFH: Bug #42173 (INTERVAL and TIMESTAMP type fixes)
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8_statement.c?r1=1.7.2.14.2.27&r2=1.7.2.14.2.28&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.27
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.27 Tue Jul 31 19:21:08 2007
+++ php-src/ext/oci8/oci8_statement.c Thu Aug 2 19:04:37 2007
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_statement.c,v 1.7.2.14.2.27 2007/07/31 19:21:08 tony2001 Exp $ */
+/* $Id: oci8_statement.c,v 1.7.2.14.2.28 2007/08/02 19:04:37 sixd Exp $ */
#ifdef HAVE_CONFIG_H
@@ -630,6 +630,15 @@
#ifdef SQLT_TIMESTAMP_TZ
|| (outcol->data_type ==
SQLT_TIMESTAMP_TZ)
#endif
+#ifdef SQLT_TIMESTAMP_LTZ
+ || (outcol->data_type ==
SQLT_TIMESTAMP_LTZ)
+#endif
+#ifdef SQLT_INTERVAL_YM
+ || (outcol->data_type ==
SQLT_INTERVAL_YM)
+#endif
+#ifdef SQLT_INTERVAL_DS
+ || (outcol->data_type ==
SQLT_INTERVAL_DS)
+#endif
) {
outcol->storage_size4 = 512; /*
XXX this should fit "most" NLS date-formats and Numbers */
#if defined(SQLT_IBFLOAT) && defined(SQLT_IBDOUBLE)
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8_interface.c?r1=1.8.2.7.2.12&r2=1.8.2.7.2.13&diff_format=u
Index: php-src/ext/oci8/oci8_interface.c
diff -u php-src/ext/oci8/oci8_interface.c:1.8.2.7.2.12
php-src/ext/oci8/oci8_interface.c:1.8.2.7.2.13
--- php-src/ext/oci8/oci8_interface.c:1.8.2.7.2.12 Tue Jul 31 21:09:01 2007
+++ php-src/ext/oci8/oci8_interface.c Thu Aug 2 19:04:37 2007
@@ -25,7 +25,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8_interface.c,v 1.8.2.7.2.12 2007/07/31 21:09:01 tony2001 Exp $ */
+/* $Id: oci8_interface.c,v 1.8.2.7.2.13 2007/08/02 19:04:37 sixd Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1183,7 +1183,22 @@
#endif
#ifdef SQLT_TIMESTAMP_TZ
case SQLT_TIMESTAMP_TZ:
- RETVAL_STRING("TIMESTAMP_TZ",1);
+ RETVAL_STRING("TIMESTAMP WITH TIMEZONE",1);
+ break;
+#endif
+#ifdef SQLT_TIMESTAMP_LTZ
+ case SQLT_TIMESTAMP_LTZ:
+ RETVAL_STRING("TIMESTAMP WITH LOCAL TIMEZONE",1);
+ break;
+#endif
+#ifdef SQLT_INTERVAL_YM
+ case SQLT_INTERVAL_YM:
+ RETVAL_STRING("INTERVAL YEAR TO MONTH",1);
+ break;
+#endif
+#ifdef SQLT_INTERVAL_DS
+ case SQLT_INTERVAL_DS:
+ RETVAL_STRING("INTERVAL DAY TO SECOND",1);
break;
#endif
case SQLT_DAT:
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/bug42173.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/bug42173.phpt
+++ php-src/ext/oci8/tests/bug42173.phpt
--TEST--
Bug #42173 (TIMESTAMP and INTERVAL query and field functions)
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
<?php
require(dirname(__FILE__).'/connect.inc');
$stmts = array(
"drop table ts_test",
"create table ts_test (
c1 TIMESTAMP,
c2 TIMESTAMP (5),
c3 TIMESTAMP WITH TIME ZONE,
c4 TIMESTAMP (2) WITH TIME ZONE,
c5 TIMESTAMP WITH LOCAL TIME ZONE,
c6 INTERVAL YEAR TO MONTH,
c7 INTERVAL YEAR(2) TO MONTH,
c8 INTERVAL DAY TO SECOND,
c9 INTERVAL DAY(2) TO SECOND(3)
)",
"insert into ts_test values (
timestamp'1999-01-03 10:00:00.123',
timestamp'1999-01-04 10:00:00.123456',
timestamp'1999-01-05 10:00:00.123456+1:0',
timestamp'1999-01-06 10:00:00.123456-1:0',
timestamp'1999-01-06 10:00:00.123456-1:0',
interval'1-2' year to month,
interval'10-4' year to month,
interval'1 2:20:20.123' day to second,
interval'1 2:20:20.12345' day to second)");
foreach ($stmts as $sql) {
$s = oci_parse($c, $sql);
$r = @oci_execute($s);
}
$s = oci_parse($c, "select * from ts_test");
$r = oci_execute($s);
$row = oci_fetch_array($s, OCI_ASSOC);
var_dump($row);
foreach ($row as $name => $field) {
echo "\nColumn $name\n";
var_dump(oci_field_is_null($s, $name));
var_dump(oci_field_name($s, $name));
var_dump(oci_field_type($s, $name));
var_dump(oci_field_type_raw($s, $name));
var_dump(oci_field_scale($s, $name));
var_dump(oci_field_precision($s, $name));
var_dump(oci_field_size($s, $name));
}
// Cleanup
$s = oci_parse($c, "drop table ts_test");
$r = @oci_execute($s);
echo "Done\n";
?>
--EXPECTF--
array(9) {
["C1"]=>
string(28) "03-JAN-99 10.00.00.123000 AM"
["C2"]=>
string(27) "04-JAN-99 10.00.00.12346 AM"
["C3"]=>
string(35) "05-JAN-99 10.00.00.123456 AM +01:00"
["C4"]=>
string(31) "06-JAN-99 10.00.00.12 AM -01:00"
["C5"]=>
string(28) "%s"
["C6"]=>
string(6) "+01-02"
["C7"]=>
string(6) "+10-04"
["C8"]=>
string(19) "+01 02:20:20.123000"
["C9"]=>
string(16) "+01 02:20:20.123"
}
Column C1
bool(false)
string(2) "C1"
string(9) "TIMESTAMP"
int(187)
int(6)
int(0)
int(11)
Column C2
bool(false)
string(2) "C2"
string(9) "TIMESTAMP"
int(187)
int(5)
int(0)
int(11)
Column C3
bool(false)
string(2) "C3"
string(23) "TIMESTAMP WITH TIMEZONE"
int(188)
int(6)
int(0)
int(13)
Column C4
bool(false)
string(2) "C4"
string(23) "TIMESTAMP WITH TIMEZONE"
int(188)
int(2)
int(0)
int(13)
Column C5
bool(false)
string(2) "C5"
string(29) "TIMESTAMP WITH LOCAL TIMEZONE"
int(232)
int(6)
int(0)
int(11)
Column C6
bool(false)
string(2) "C6"
string(22) "INTERVAL YEAR TO MONTH"
int(189)
int(0)
int(2)
int(5)
Column C7
bool(false)
string(2) "C7"
string(22) "INTERVAL YEAR TO MONTH"
int(189)
int(0)
int(2)
int(5)
Column C8
bool(false)
string(2) "C8"
string(22) "INTERVAL DAY TO SECOND"
int(190)
int(6)
int(2)
int(11)
Column C9
bool(false)
string(2) "C9"
string(22) "INTERVAL DAY TO SECOND"
int(190)
int(3)
int(2)
int(11)
Done
--UEXPECTF--
array(9) {
[u"C1"]=>
unicode(28) "03-JAN-99 10.00.00.123000 AM"
[u"C2"]=>
unicode(27) "04-JAN-99 10.00.00.12346 AM"
[u"C3"]=>
unicode(35) "05-JAN-99 10.00.00.123456 AM +01:00"
[u"C4"]=>
unicode(31) "06-JAN-99 10.00.00.12 AM -01:00"
[u"C5"]=>
unicode(28) "%s"
[u"C6"]=>
unicode(6) "+01-02"
[u"C7"]=>
unicode(6) "+10-04"
[u"C8"]=>
unicode(19) "+01 02:20:20.123000"
[u"C9"]=>
unicode(16) "+01 02:20:20.123"
}
Column C1
bool(false)
unicode(2) "C1"
unicode(9) "TIMESTAMP"
int(187)
int(6)
int(0)
int(11)
Column C2
bool(false)
unicode(2) "C2"
unicode(9) "TIMESTAMP"
int(187)
int(5)
int(0)
int(11)
Column C3
bool(false)
unicode(2) "C3"
unicode(23) "TIMESTAMP WITH TIMEZONE"
int(188)
int(6)
int(0)
int(13)
Column C4
bool(false)
unicode(2) "C4"
unicode(23) "TIMESTAMP WITH TIMEZONE"
int(188)
int(2)
int(0)
int(13)
Column C5
bool(false)
unicode(2) "C5"
unicode(29) "TIMESTAMP WITH LOCAL TIMEZONE"
int(232)
int(6)
int(0)
int(11)
Column C6
bool(false)
unicode(2) "C6"
unicode(22) "INTERVAL YEAR TO MONTH"
int(189)
int(0)
int(2)
int(5)
Column C7
bool(false)
unicode(2) "C7"
unicode(22) "INTERVAL YEAR TO MONTH"
int(189)
int(0)
int(2)
int(5)
Column C8
bool(false)
unicode(2) "C8"
unicode(22) "INTERVAL DAY TO SECOND"
int(190)
int(6)
int(2)
int(11)
Column C9
bool(false)
unicode(2) "C9"
unicode(22) "INTERVAL DAY TO SECOND"
int(190)
int(3)
int(2)
int(11)
Done
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php