From: Antony Dovgal Date: Wed, 12 Apr 2006 19:22:12 +0000 (+0000) Subject: MF51: fix #37059 (oci_bind_by_name() doesn't support RAW and LONG RAW fields) X-Git-Tag: RELEASE_1_3~81 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=000cf5ca7fb49fb5e4ab024c0c985802013b1113;p=php MF51: fix #37059 (oci_bind_by_name() doesn't support RAW and LONG RAW fields) add tests --- diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 87e5f3a775..1c73008ed4 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -541,6 +541,8 @@ PHP_MINIT_FUNCTION(oci) REGISTER_LONG_CONSTANT("SQLT_FLT",SQLT_FLT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SQLT_UIN",SQLT_UIN, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SQLT_LNG",SQLT_LNG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_LBI",SQLT_LBI, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SQLT_BIN",SQLT_BIN, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SQLT_ODT",SQLT_ODT, CONST_CS | CONST_PERSISTENT); #if defined(HAVE_OCI_INSTANT_CLIENT) || (defined(OCI_MAJOR_VERSION) && OCI_MAJOR_VERSION > 10) REGISTER_LONG_CONSTANT("SQLT_BDOUBLE",SQLT_BDOUBLE, CONST_CS | CONST_PERSISTENT); diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index f930fdaa77..16a2b7e182 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -493,6 +493,9 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) case SQLT_BIN: default: define_type = SQLT_CHR; + if (outcol->data_type == SQLT_BIN) { + define_type = SQLT_BIN; + } if ((outcol->data_type == SQLT_DAT) || (outcol->data_type == SQLT_NUM) #ifdef SQLT_TIMESTAMP || (outcol->data_type == SQLT_TIMESTAMP) @@ -813,6 +816,9 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, mode = OCI_DEFAULT; break; + case SQLT_LBI: + case SQLT_BIN: + case SQLT_LNG: case SQLT_CHR: /* this is the default case when type was not specified */ convert_to_string(var); diff --git a/ext/oci8/tests/bind_long.phpt b/ext/oci8/tests/bind_long.phpt new file mode 100644 index 0000000000..58590f145a --- /dev/null +++ b/ext/oci8/tests/bind_long.phpt @@ -0,0 +1,38 @@ +--TEST-- +bind LONG field +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(32) "d04e7036e2f4221abc88fd14e960a45b" +int(2523) +Done diff --git a/ext/oci8/tests/bind_long_raw.phpt b/ext/oci8/tests/bind_long_raw.phpt new file mode 100644 index 0000000000..2a9962eace --- /dev/null +++ b/ext/oci8/tests/bind_long_raw.phpt @@ -0,0 +1,38 @@ +--TEST-- +bind LONG RAW field +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(32) "614fcbba1effb7caa27ef0ef25c27fcf" +int(2523) +Done diff --git a/ext/oci8/tests/bind_raw.phpt b/ext/oci8/tests/bind_raw.phpt new file mode 100644 index 0000000000..c9087e552b --- /dev/null +++ b/ext/oci8/tests/bind_raw.phpt @@ -0,0 +1,39 @@ +--TEST-- +bind RAW field +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(32) "88b274d7a257ac6f70435b83abd4e26e" +int(300) +Done diff --git a/ext/oci8/tests/test.gif b/ext/oci8/tests/test.gif new file mode 100644 index 0000000000..f352c7308f Binary files /dev/null and b/ext/oci8/tests/test.gif differ