more compliance with the ODBC 3.x

This commit is contained in:
Anatol Belski 2015-04-02 20:18:11 +02:00
parent 48447da836
commit b3a027d610
2 changed files with 8 additions and 6 deletions

View File

@ -954,9 +954,9 @@ int odbc_bindcols(odbc_result *result)
charextraalloc = 0;
colfieldid = SQL_COLUMN_DISPLAY_SIZE;
rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_NAME,
rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_NAME,
result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0);
rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE,
rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE,
NULL, 0, NULL, &result->values[i].coltype);
/* Don't bind LONG / BINARY columns, so that fetch behaviour can
@ -991,7 +991,7 @@ int odbc_bindcols(odbc_result *result)
charextraalloc = 1;
#endif
default:
rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), colfieldid,
rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), colfieldid,
NULL, 0, NULL, &displaysize);
/* Workaround for Oracle ODBC Driver bug (#50162) when fetching TIMESTAMP column */
if (result->values[i].coltype == SQL_TIMESTAMP) {
@ -1089,7 +1089,7 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type)
RETURN_FALSE;
}
SQLColAttributes(result->stmt, (SQLUSMALLINT)pv_num, (SQLUSMALLINT) (type?SQL_COLUMN_SCALE:SQL_COLUMN_PRECISION), NULL, 0, NULL, &len);
PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, (SQLUSMALLINT) (type?SQL_COLUMN_SCALE:SQL_COLUMN_PRECISION), NULL, 0, NULL, &len);
RETURN_LONG(len);
}
@ -2135,7 +2135,7 @@ PHP_FUNCTION(odbc_result)
fieldsize = result->longreadlen;
}
} else {
SQLColAttributes(result->stmt, (SQLUSMALLINT)(field_ind + 1),
PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(field_ind + 1),
(SQLUSMALLINT)((sql_c_type == SQL_C_BINARY) ? SQL_COLUMN_LENGTH :
SQL_COLUMN_DISPLAY_SIZE),
NULL, 0, NULL, &fieldsize);
@ -2890,7 +2890,7 @@ PHP_FUNCTION(odbc_field_type)
RETURN_FALSE;
}
SQLColAttributes(result->stmt, (SQLUSMALLINT)pv_num, SQL_COLUMN_TYPE_NAME, tmp, 31, &tmplen, NULL);
PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, SQL_COLUMN_TYPE_NAME, tmp, 31, &tmplen, NULL);
RETURN_STRING(tmp)
}
/* }}} */

View File

@ -281,8 +281,10 @@ void odbc_sql_error(ODBC_SQL_ERROR_PARAMS);
#if defined(ODBCVER) && (ODBCVER >= 0x0300)
#define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR || x == SQL_WLONGVARCHAR)
#define PHP_ODBC_SQLCOLATTRIBUTE SQLColAttribute
#else
#define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR)
#define PHP_ODBC_SQLCOLATTRIBUTE SQLColAttributes
#endif
#define IS_SQL_BINARY(x) (x == SQL_BINARY || x == SQL_VARBINARY || x == SQL_LONGVARBINARY)