From 2384ade53c9ddb45b56e803a8d8494737732b84b Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 22 Jan 2018 17:02:54 +0100 Subject: [PATCH] Fixed bug #73725 Unable to retrieve value of varchar(max) type --- ext/odbc/php_odbc.c | 7 +++++ ext/odbc/tests/bug73725.phpt | 55 ++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 ext/odbc/tests/bug73725.phpt diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 918c7bbf97..514b8de74d 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -1027,6 +1027,13 @@ int odbc_bindcols(odbc_result *result) break; } #endif + /* Workaround for drivers that report VARCHAR(MAX) columns as SQL_VARCHAR (bug #73725) */ + if (SQL_VARCHAR == result->values[i].coltype && displaysize == 0) { + result->values[i].coltype = SQL_LONGVARCHAR; + result->values[i].value = NULL; + break; + } + /* Workaround for Oracle ODBC Driver bug (#50162) when fetching TIMESTAMP column */ if (result->values[i].coltype == SQL_TIMESTAMP) { displaysize += 3; diff --git a/ext/odbc/tests/bug73725.phpt b/ext/odbc/tests/bug73725.phpt new file mode 100644 index 0000000000..f0ab6ccc9a --- /dev/null +++ b/ext/odbc/tests/bug73725.phpt @@ -0,0 +1,55 @@ +--TEST-- +Bug #73725 Unable to retrieve value of varchar(max) type +--SKIPIF-- + +--FILE-- + +==DONE== +--EXPECT-- +array(3) { + ["i"]=> + string(3) "101" + ["txt"]=> + string(8) "Any text" + ["k"]=> + string(2) "33" +} +array(3) { + ["i"]=> + string(3) "102" + ["txt"]=> + string(12) "Müsliriegel" + ["k"]=> + string(2) "34" +} +==DONE== +--CLEAN-- + -- 2.49.0