DbLib: Fixes for MySQL ODBC driver

SQLSetConnectAttr crashes for this driver, and SQLSetStmtAttr is the ODBC3 way anyway.
This commit is contained in:
Jon Evans 2022-09-01 00:24:56 -04:00
parent 9188838e50
commit 60f6bb8c77
2 changed files with 15 additions and 21 deletions

View File

@ -449,11 +449,11 @@ bool DATABASE_CONNECTION::SelectAll( const std::string& aTable, std::vector<ROW>
return false;
}
if( !results.first() )
return false;
try
{
if( !results.first() )
return false;
do
{
ROW result;

View File

@ -995,15 +995,6 @@ public:
if (!success(rc) && (event_handle == nullptr || rc != SQL_STILL_EXECUTING))
NANODBC_THROW_DATABASE_ERROR(dbc_, SQL_HANDLE_DBC);
int cursorType = SQL_CURSOR_KEYSET_DRIVEN;
NANODBC_CALL_RC(
SQLSetConnectAttr,
rc,
dbc_,
SQL_ATTR_CURSOR_TYPE,
(SQLPOINTER)(std::intptr_t)cursorType,
0);
connected_ = success(rc);
return rc;
@ -1054,15 +1045,6 @@ public:
if (!success(rc) && (event_handle == nullptr || rc != SQL_STILL_EXECUTING))
NANODBC_THROW_DATABASE_ERROR(dbc_, SQL_HANDLE_DBC);
int cursorType = SQL_CURSOR_KEYSET_DRIVEN;
NANODBC_CALL_RC(
SQLSetConnectAttr,
rc,
dbc_,
SQL_ATTR_CURSOR_TYPE,
(SQLPOINTER)(std::intptr_t)cursorType,
0);
connected_ = success(rc);
return rc;
@ -1452,6 +1434,18 @@ public:
#endif
RETCODE rc;
int cursorType = SQL_CURSOR_KEYSET_DRIVEN;
NANODBC_CALL_RC(
SQLSetStmtAttr,
rc,
stmt_,
SQL_ATTR_CURSOR_TYPE,
(SQLPOINTER)(std::intptr_t)cursorType,
0);
if (!success(rc) && rc != SQL_STILL_EXECUTING)
NANODBC_THROW_DATABASE_ERROR(stmt_, SQL_HANDLE_STMT);
NANODBC_CALL_RC(
NANODBC_FUNC(SQLPrepare),
rc,