From b3f27869852c61a0086923b3d6e89638eaa87ba5 Mon Sep 17 00:00:00 2001 From: derrickturk Date: Sat, 21 Jul 2018 13:56:05 -0500 Subject: [PATCH] Fix #14 @derrickturk has identified (https://github.com/derrickturk/hdbc-odbc/commit/99cbefb16defc9ce6de77c1434207a78b5c3c365) that, in the case of the MS Access driver, the `BufferLength` argument of function `SQLGetInfo` cannot be ignored (set to 0), despite what is implied by the Microsoft documentation (https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlgetinfo-function?view=sql-server-2017). `InfoType` `SQL_TXN_CAPABLE` returns a `SQLUSMALLINT` value and the `BufferLength` must be set accordingly. --- Database/HDBC/ODBC/Connection.hsc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Database/HDBC/ODBC/Connection.hsc b/Database/HDBC/ODBC/Connection.hsc index 09aaf21..3f0d404 100644 --- a/Database/HDBC/ODBC/Connection.hsc +++ b/Database/HDBC/ODBC/Connection.hsc @@ -117,7 +117,7 @@ mkConn args iconn = withDbcOrDie iconn $ \cconn -> clientname <- peekCStringLen (pbuf, fromIntegral len) sqlGetInfo cconn #{const SQL_TXN_CAPABLE} (castPtr psqlusmallint) - 0 nullPtr + #{size SQLUSMALLINT} nullPtr >>= checkError "sqlGetInfo SQL_TXN_CAPABLE" (DbcHandle cconn) txninfo <- ((peek psqlusmallint)::IO (#{type SQLUSMALLINT})) let txnsupport = txninfo /= #{const SQL_TC_NONE}