odbc regression from #14357 (#15417)

#14357 changed from sending 'val', an int, to a pointer to int, which is understandable, but not how SQLSetEnvAttr works.
"Depending on the value of Attribute, ValuePtr will be a 32-bit integer value or point to a null-terminated character string"
This commit is contained in:
shirleyquirk 2020-09-29 16:08:24 +01:00 • committed by GitHub
commit f8866598e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -508,7 +508,7 @@ proc open*(connection, user, password, database: string): DbConn {.
if res != SQL_SUCCESS: dbError("Error: unable to initialise ODBC environment.") if res != SQL_SUCCESS: dbError("Error: unable to initialise ODBC environment.")
res = SQLSetEnvAttr(result.env, res = SQLSetEnvAttr(result.env,
SQL_ATTR_ODBC_VERSION.TSqlInteger, SQL_ATTR_ODBC_VERSION.TSqlInteger,
cast[SqlPointer](val.addr), resLen.TSqlInteger) cast[SqlPointer](val), resLen.TSqlInteger)
if res != SQL_SUCCESS: dbError("Error: unable to set ODBC driver version.") if res != SQL_SUCCESS: dbError("Error: unable to set ODBC driver version.")
# allocate hDb handle # allocate hDb handle
res = SQLAllocHandle(SQL_HANDLE_DBC, result.env, result.hDb) res = SQLAllocHandle(SQL_HANDLE_DBC, result.env, result.hDb)