AnsweredAssumed Answered

ODBC driver incorrectly returns error when SQLFreeStmt with SQL_CLOSE called more than once

Question asked by barefootguru on Apr 26, 2013
Latest reply on May 29, 2014 by TSGal

Summary

ODBC driver incorrectly returns error when SQLFreeStmt with SQL_CLOSE called more than once

Product

FileMaker Server

Version

12.0v3

Operating system version

Windows Server 2008 R2 Enterprise SP1

Description of the issue

When calling SQLFreeStmt with the SQL_CLOSE option more than once, the driver is returning an error.  According to the MS ODBC API that is a driver bug.

This causes SAS to report an error when retrieving ODBC data, even though the pull is successful.

Steps to reproduce the problem

Development captured an ODBC trace to investigate why we see an ERROR in the SAS log when everything appears to have run successful:
"...
ODBC: Exit duget, rc = X_WEOF, table is onlynumeric, statement 1, connection 0
ACCESS ENGINE:  Enter yoeclos
ODBC: Enter dugett, table is onlynumeric, statement 1, connection 0
ODBC: ENTER SQLFreeStmt
            0x025b15f8
                     0
ODBC: EXIT SQLFreeStmt with return code 0 (SQL_SUCCESS)
            0x025b15f8
                     0
ODBC: Close cursor from statement 1 on connection 0
ODBC: Exit dugett, rc = SUCCESS
ODBC: Enter dudesct, table is onlynumeric, statement 1, connection 0
ODBC: ENTER SQLFreeStmt
            0x025b15f8
                     0
ODBC: EXIT SQLFreeStmt with return code -1 (SQL_ERROR)
            0x025b15f8
                     0
ODBC: Exit du, rc = DBU_CLOSERR
ACCESS ENGINE: Exit yoeclos with rc=0x8012780b
ERROR: CLI close cursor error: [FileMaker][FileMaker] No cursor open for statement
..."

Basically, we are calling SQLFreeStmt with the SQL_CLOSE option more than once and the driver is returning an error.  According to the MS ODBC API that is a driver bug.

http://msdn.microsoft.com/en-us/library/ms709284(v=vs.85).aspx

StatementHandle
[Input] Statement handle
Option
[Input] One of the following options:
SQL_ CLOSE: Closes the cursor associated with StatementHandle (if one was defined) and discards all pending results. The application can reopen this cursor later by executing a SELECT statement again with the same or different parameter values. If no cursor is open, this option has no effect for the application.

Configuration information

Workstation used to pull ODBC data is:

Windows 7 64-bit with 64-bit SAS 9.3 T1M2 and 64-bit FileMaker Pro ODBC driver 12.0.103.00

Outcomes