-
-
Save cmb69/839d5e04395936ad64fd049d2cb7fd55 to your computer and use it in GitHub Desktop.
PHP ODBC don't bind
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ext/odbc/php_odbc.c | 17 +++++++++++++++++ | |
1 file changed, 17 insertions(+) | |
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c | |
index d4de4ec75b..073e406050 100644 | |
--- a/ext/odbc/php_odbc.c | |
+++ b/ext/odbc/php_odbc.c | |
@@ -48,6 +48,8 @@ | |
#endif | |
+#define ODBC_DONT_BIND | |
+ | |
/* | |
* not defined elsewhere | |
*/ | |
@@ -631,6 +633,11 @@ int odbc_bindcols(odbc_result *result) | |
rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE, | |
NULL, 0, NULL, &result->values[i].coltype); | |
+#ifdef ODBC_DONT_BIND | |
+ result->values[i].value = NULL; | |
+ continue; | |
+#endif | |
+ | |
/* Don't bind LONG / BINARY columns, so that fetch behaviour can | |
* be controlled by odbc_binmode() / odbc_longreadlen() | |
*/ | |
@@ -1422,6 +1429,9 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) | |
case SQL_LONGVARCHAR: | |
#if defined(ODBCVER) && (ODBCVER >= 0x0300) | |
case SQL_WLONGVARCHAR: | |
+#endif | |
+#ifdef ODBC_DONT_BIND | |
+ default: | |
#endif | |
if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { | |
ZVAL_EMPTY_STRING(&tmp); | |
@@ -1455,6 +1465,7 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) | |
} | |
break; | |
+#ifndef ODBC_DONT_BIND | |
default: | |
if (result->values[i].vallen == SQL_NULL_DATA) { | |
ZVAL_NULL(&tmp); | |
@@ -1466,6 +1477,7 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) | |
} | |
ZVAL_STRINGL(&tmp, result->values[i].value, result->values[i].vallen); | |
break; | |
+#endif | |
} | |
if (result_type & ODBC_NUM) { | |
@@ -1814,6 +1826,9 @@ PHP_FUNCTION(odbc_result) | |
case SQL_LONGVARCHAR: | |
#if defined(ODBCVER) && (ODBCVER >= 0x0300) | |
case SQL_WLONGVARCHAR: | |
+#endif | |
+#ifdef ODBC_DONT_BIND | |
+ default: | |
#endif | |
if (IS_SQL_LONG(result->values[field_ind].coltype)) { | |
if (result->longreadlen <= 0) { | |
@@ -1874,6 +1889,7 @@ PHP_FUNCTION(odbc_result) | |
RETURN_NEW_STR(field_str); | |
break; | |
+#ifndef ODBC_DONT_BIND | |
default: | |
if (result->values[field_ind].vallen == SQL_NULL_DATA) { | |
RETURN_NULL(); | |
@@ -1884,6 +1900,7 @@ PHP_FUNCTION(odbc_result) | |
RETURN_STRINGL(result->values[field_ind].value, result->values[field_ind].vallen); | |
} | |
break; | |
+#endif | |
} | |
/* If we come here, output unbound LONG and/or BINARY column data to the client */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment