Properly initialize out parameter

The MS docs on `SQLColAttribute()`[1] state regarding the
`NumericAttributePtr` parameter:

| Please note that some drivers may only write the lower 32-bit or
| 16-bit of a buffer and leave the higher-order bit unchanged.
| Therefore, applications should initialize the value to 0 before
| calling this function.

[1] <https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlcolattribute-function?view=sql-server-2017>
This commit is contained in:
Christoph M. Becker 2019-04-29 12:17:38 +02:00
parent c79d5b86e0
commit 71e9013bab

View File

@ -956,6 +956,7 @@ int odbc_bindcols(odbc_result *result)
rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), PHP_ODBC_SQL_DESC_NAME,
result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0);
result->values[i].coltype = 0;
rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE,
NULL, 0, NULL, &result->values[i].coltype);