ODBC SQLBindCol()的指针错误,但是可以工作。这怎么可能?

时间:2019-07-03 03:26:13

标签: c++ c database odbc

当我执行ODBC应用程序时,我能够做到这一点而没有任何问题。 但是,一旦检查了跟踪日志,我发现指针分配中的值很奇怪。

这是跟踪日志的一部分。

WCCOActrl.exe - 329c-2160   ENTER SQLGetStmtAttrW 
        SQLHSTMT            0x0000000000C57FD0
        SQLINTEGER                  11 <SQL_ATTR_RETRIEVE_DATA>
        SQLPOINTER          0x000000000A55EF90
        SQLINTEGER                  -6 
        SQLINTEGER *        0x0000000000000000

WCCOActrl.exe - 329c-2160   EXIT  SQLGetStmtAttrW  with return code 0 (SQL_SUCCESS)
        SQLHSTMT            0x0000000000C57FD0
        SQLINTEGER                  11 <SQL_ATTR_RETRIEVE_DATA>
        SQLPOINTER          0x000000000A55EF90 (1) <SQL_RD_ON>
        SQLINTEGER                  -6 
        SQLINTEGER *        0x0000000000000000

WCCOActrl.exe - 329c-2160   ENTER SQLSetStmtAttrW 
        SQLHSTMT            0x0000000000C57FD0
        SQLINTEGER                  11 <SQL_ATTR_RETRIEVE_DATA>
        SQLPOINTER                 1 <SQL_RD_ON>
        SQLINTEGER                  -6 

WCCOActrl.exe - 329c-2160   EXIT  SQLSetStmtAttrW  with return code 0 (SQL_SUCCESS)
        SQLHSTMT            0x0000000000C57FD0
        SQLINTEGER                  11 <SQL_ATTR_RETRIEVE_DATA>
        SQLPOINTER                 1 <SQL_RD_ON>
        SQLINTEGER                  -6 

WCCOActrl.exe - 329c-2160   ENTER SQLSetStmtAttrW 
        SQLHSTMT            0x0000000000C57FD0
        SQLINTEGER                  23 <SQL_ATTR_ROW_BIND_OFFSET_PTR>
        SQLPOINTER          0x00000000076FE5D0
        SQLINTEGER                  -4 

WCCOActrl.exe - 329c-2160   EXIT  SQLSetStmtAttrW  with return code 0 (SQL_SUCCESS)
        SQLHSTMT            0x0000000000C57FD0
        SQLINTEGER                  23 <SQL_ATTR_ROW_BIND_OFFSET_PTR>
        SQLPOINTER          0x00000000076FE5D0
        SQLINTEGER                  -4 

WCCOActrl.exe - 329c-2160   ENTER SQLBindCol 
        HSTMT               0x0000000000C57FD0
        UWORD                        1 
        SWORD                        1 <SQL_C_CHAR>
        PTR                0x0000000000000098
        SQLLEN                   256
        SQLLEN *            0x0000000000000090

WCCOActrl.exe - 329c-2160   EXIT  SQLBindCol  with return code 0 (SQL_SUCCESS)
        HSTMT               0x0000000000C57FD0
        UWORD                        1 
        SWORD                        1 <SQL_C_CHAR>
        PTR                0x0000000000000098
        SQLLEN                   256
        SQLLEN *            0x0000000000000090 (BADMEM)

WCCOActrl.exe - 329c-2160   ENTER SQLBindCol 
        HSTMT               0x0000000000C57FD0
        UWORD                        2 
        SWORD                        1 <SQL_C_CHAR>
        PTR                0x00000000000001A8
        SQLLEN                   201
        SQLLEN *            0x00000000000001A0

WCCOActrl.exe - 329c-2160   EXIT  SQLBindCol  with return code 0 (SQL_SUCCESS)
        HSTMT               0x0000000000C57FD0
        UWORD                        2 
        SWORD                        1 <SQL_C_CHAR>
        PTR                0x00000000000001A8
        SQLLEN                   201
        SQLLEN *            0x00000000000001A0 (BADMEM)

WCCOActrl.exe - 329c-2160   ENTER SQLBindCol 
        HSTMT               0x0000000000C57FD0
        UWORD                        3 
        SWORD                      -25 <SQL_C_SBIGINT>
        PTR                0x0000000000000288
        SQLLEN                    20
        SQLLEN *            0x0000000000000280

WCCOActrl.exe - 329c-2160   EXIT  SQLBindCol  with return code 0 (SQL_SUCCESS)
        HSTMT               0x0000000000C57FD0
        UWORD                        3 
        SWORD                      -25 <SQL_C_SBIGINT>
        PTR                0x0000000000000288
        SQLLEN                    20
        SQLLEN *            0x0000000000000280 (BADMEM)

WCCOActrl.exe - 329c-2160   ENTER SQLBindCol 
        HSTMT               0x0000000000C57FD0
        UWORD                        4 
        SWORD                        1 <SQL_C_CHAR>
        PTR                0x00000000000002B0
        SQLLEN                    11
        SQLLEN *            0x00000000000002A8

WCCOActrl.exe - 329c-2160   EXIT  SQLBindCol  with return code 0 (SQL_SUCCESS)
        HSTMT               0x0000000000C57FD0
        UWORD                        4 
        SWORD                        1 <SQL_C_CHAR>
        PTR                0x00000000000002B0
        SQLLEN                    11
        SQLLEN *            0x00000000000002A8 (BADMEM)

WCCOActrl.exe - 329c-2160   ENTER SQLSetStmtAttrW 
        SQLHSTMT            0x0000000000C57FD0
        SQLINTEGER                   9 <SQL_ROWSET_SIZE>
        SQLPOINTER                 1
        SQLINTEGER                  -6 

WCCOActrl.exe - 329c-2160   EXIT  SQLSetStmtAttrW  with return code 0 (SQL_SUCCESS)
        SQLHSTMT            0x0000000000C57FD0
        SQLINTEGER                   9 <SQL_ROWSET_SIZE>
        SQLPOINTER                 1
        SQLINTEGER                  -6 

WCCOActrl.exe - 329c-2160   ENTER SQLExtendedFetch 
        HSTMT               0x0000000000C57FD0
        UWORD                        1 <SQL_FETCH_NEXT>
        SQLLEN                     0
        SQLULEN *           0x000000000A55F040
        UWORD *             0x00000000076FC0B0

如您在SQLBindCol()中看到的PTR,PTR的值是错误的。 (它必须具有有效的指针...)

有人可以帮我解释一下吗?

它在“ mysql odbc驱动程序”上工作得很好,但是在我自己的驱动程序上却没有。

这怎么可能?

0 个答案:

没有答案