From f894c6ece74160e6753992a8f85ccff90ae1a43a Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 2 Aug 2007 19:04:37 +0000 Subject: [PATCH] MFH: Bug #42173 (INTERVAL and TIMESTAMP type fixes) --- ext/oci8/oci8_interface.c | 17 +++- ext/oci8/oci8_statement.c | 9 ++ ext/oci8/tests/bug42173.phpt | 168 +++++++++++++++++++++++++++++++++++ 3 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 ext/oci8/tests/bug42173.phpt diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index 834cf99dda..f8d791e84e 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -1183,7 +1183,22 @@ PHP_FUNCTION(oci_field_type) #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: diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index fa592bc025..6b03536772 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -629,6 +629,15 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) #endif #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 */ diff --git a/ext/oci8/tests/bug42173.phpt b/ext/oci8/tests/bug42173.phpt new file mode 100644 index 0000000000..501ed75cd0 --- /dev/null +++ b/ext/oci8/tests/bug42173.phpt @@ -0,0 +1,168 @@ +--TEST-- +Bug #42173 (TIMESTAMP and INTERVAL query and field functions) +--SKIPIF-- + +--FILE-- + $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 -- 2.40.0