From 65364fe7d00319f6bfb4814980988d34183f9f78 Mon Sep 17 00:00:00 2001 From: Keyur Govande Date: Wed, 30 Jul 2014 02:28:31 +0000 Subject: Corrected patch for bug #60616 For unixODBC, use ODBC version as defined by it (as of v2.2.14 it is 3.5). This allows us to use newer features like SQL_DESC_OCTET_LENGTH (which returns the number of bytes required to store the data). This fixes the issue in #60616. If the newer version is not available, over-allocate to accomodate 4-byte Unicode characters for CHAR and VARCHAR datatypes (and their Wide counterparts). version. Fixed a couple of failing tests. --- ext/odbc/php_odbc_includes.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ext/odbc/php_odbc_includes.h') diff --git a/ext/odbc/php_odbc_includes.h b/ext/odbc/php_odbc_includes.h index b3ae889974..06113d9624 100644 --- a/ext/odbc/php_odbc_includes.h +++ b/ext/odbc/php_odbc_includes.h @@ -115,6 +115,7 @@ PHP_FUNCTION(solid_fetch_prev); #endif #define ODBC_TYPE "unixODBC" +#undef ODBCVER #include #include #define HAVE_SQL_EXTENDED_FETCH 1 @@ -284,7 +285,11 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC); void odbc_sql_error(ODBC_SQL_ERROR_PARAMS); -#define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR || x == SQL_WVARCHAR || x == SQL_WLONGVARCHAR) +#if defined(ODBCVER) && (ODBCVER >= 0x0300) +#define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR || x == SQL_WLONGVARCHAR) +#else +#define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR) +#endif #define IS_SQL_BINARY(x) (x == SQL_BINARY || x == SQL_VARBINARY || x == SQL_LONGVARBINARY) #ifdef ZTS -- cgit v1.2.1