summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDan Kalowsky <kalowsky@php.net>2003-01-07 22:56:58 +0000
committerDan Kalowsky <kalowsky@php.net>2003-01-07 22:56:58 +0000
commitb89d9db7064339cec7b4744839b6bf2b4880d0cb (patch)
tree13624ec3019a94f989b5c4602e1c4cb217792707 /ext
parentb064810550caa492cb0dd4ae973c033e0cefa55c (diff)
downloadphp-git-b89d9db7064339cec7b4744839b6bf2b4880d0cb.tar.gz
Reverting last change as it really doesn't fix longreadlen problems in all
cases.
Diffstat (limited to 'ext')
-rw-r--r--ext/odbc/config.m41
-rw-r--r--ext/odbc/php_odbc.c15
2 files changed, 6 insertions, 10 deletions
diff --git a/ext/odbc/config.m4 b/ext/odbc/config.m4
index e2ce2cbe55..67839c56a7 100644
--- a/ext/odbc/config.m4
+++ b/ext/odbc/config.m4
@@ -373,6 +373,7 @@ AC_ARG_WITH(iodbc,
ODBC_LFLAGS=-L$withval/lib
ODBC_LIBS=-liodbc
AC_DEFINE(HAVE_IODBC,1,[ ])
+ AC_DEFINE(HAVE_ODBC2,1,[ ])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index be70195a45..221f366e56 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -609,24 +609,19 @@ void php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode)
WRONG_PARAM_COUNT;
convert_to_long_ex(pv_flag);
- ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
- /* if (Z_LVAL_PP(pv_res)) { */
+ if (Z_LVAL_PP(pv_res)) {
+ ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (mode)
result->longreadlen = Z_LVAL_PP(pv_flag);
else
result->binmode = Z_LVAL_PP(pv_flag);
-/*
- * According to the documentation there is no possible way for you to run these functions
- * without having a result set.
- *
} else {
if (mode)
ODBCG(defaultlrl) = Z_LVAL_PP(pv_flag);
else
ODBCG(defaultbinmode) = Z_LVAL_PP(pv_flag);
}
-*/
RETURN_TRUE;
}
/* }}} */
@@ -1830,7 +1825,7 @@ PHP_FUNCTION(odbc_result)
NULL, 0, NULL, &fieldsize);
}
/* For char data, the length of the returned string will be longreadlen - 1 */
- fieldsize = (result->longreadlen <= 0) ? ODBCG(defaultlrl) : result->longreadlen;
+ fieldsize = (result->longreadlen <= 0) ? 4096 : result->longreadlen;
field = emalloc(fieldsize);
if (!field) {
php_error(E_WARNING, "Out of memory");
@@ -1875,7 +1870,7 @@ PHP_FUNCTION(odbc_result)
/* If we come here, output unbound LONG and/or BINARY column data to the client */
/* We emalloc 1 byte more for SQL_C_CHAR (trailing \0) */
- fieldsize = (sql_c_type == SQL_C_CHAR) ? ODBCG(defaultlrl)+1: ODBCG(defaultlrl);
+ fieldsize = (sql_c_type == SQL_C_CHAR) ? 4096 : 4095;
if ((field = emalloc(fieldsize)) == NULL) {
php_error(E_WARNING,"Out of memory");
RETURN_FALSE;
@@ -1897,7 +1892,7 @@ PHP_FUNCTION(odbc_result)
RETURN_FALSE;
}
/* chop the trailing \0 by outputing only 4095 bytes */
- PHPWRITE(field,(rc == SQL_SUCCESS_WITH_INFO) ? ODBCG(defaultlrl) :
+ PHPWRITE(field,(rc == SQL_SUCCESS_WITH_INFO) ? 4095 :
result->values[field_ind].vallen);
if (rc == SQL_SUCCESS) { /* no more data avail */