Index: driver/myodbc3.h =================================================================== --- driver/myodbc3.h (revision 607) +++ driver/myodbc3.h (working copy) @@ -164,6 +164,7 @@ #define FLAG_AUTO_IS_NULL (FLAG_SAFE << 6) /* 8388608 Enables SQL_AUTO_IS_NULL */ #define FLAG_ZERO_DATE_TO_MIN (1 << 24) /* Convert XXXX-00-00 date to ODBC min date on results */ #define FLAG_MIN_DATE_TO_ZERO (1 << 25) /* Convert ODBC min date to 0000-00-00 on query */ +#define FLAG_MULTI_STATEMENTS (1 << 26) /* Allow multiple statements in a query */ /* We don't make any assumption about what the default may be. */ #ifndef DEFAULT_TXN_ISOLATION Index: driver/connect.c =================================================================== --- driver/connect.c (revision 607) +++ driver/connect.c (working copy) @@ -61,6 +61,8 @@ flags|= CLIENT_COMPRESS; if (options & FLAG_IGNORE_SPACE) flags|= CLIENT_IGNORE_SPACE; + if (options & FLAG_MULTI_STATEMENTS) + flags|= CLIENT_MULTI_STATEMENTS; return flags; } Index: test/my_basics.c =================================================================== --- test/my_basics.c (revision 607) +++ test/my_basics.c (working copy) @@ -345,6 +345,48 @@ } +/** + Bug #7445: MyODBC still doesn't support batch statements +*/ +DECLARE_TEST(t_bug7445) +{ + SQLLEN nRowCount; + SQLHENV henv1; + SQLHDBC hdbc1; + SQLHSTMT hstmt1; + + SET_DSN_OPTION(1 << 26); + + alloc_basic_handles(&henv1, &hdbc1, &hstmt1); + + ok_sql(hstmt1, "DROP TABLE IF EXISTS t_bug7445"); + + /* create the table 'myodbc3_demo_result' */ + ok_sql(hstmt1, + "CREATE TABLE t_bug7445(name VARCHAR(20))"); + + /* multi statement insert */ + ok_sql(hstmt1, "INSERT INTO t_bug7445 VALUES ('bogdan');" + "INSERT INTO t_bug7445 VALUES ('georg');" + "INSERT INTO t_bug7445 VALUES ('tonci');" + "INSERT INTO t_bug7445 VALUES ('jim')"); + + ok_sql(hstmt1, "SELECT COUNT(*) FROM t_bug7445"); + + /* get the rows affected by update statement */ + ok_stmt(hstmt1, SQLRowCount(hstmt1, &nRowCount)); + is_num(nRowCount, 1); + + ok_stmt(hstmt1, SQLFreeStmt(hstmt1, SQL_CLOSE)); + + ok_sql(hstmt1, "DROP TABLE t_bug7445"); + + free_basic_handles(&henv1, &hdbc1, &hstmt1); + + return OK; +} + + BEGIN_TESTS ADD_TEST(my_basics) ADD_TEST(t_max_select) @@ -356,6 +398,7 @@ #endif ADD_TEST(charset_utf8) ADD_TEST(charset_gbk) + ADD_TEST(t_bug7445) END_TESTS Index: ChangeLog =================================================================== --- ChangeLog (revision 607) +++ ChangeLog (working copy) @@ -1,6 +1,8 @@ 3.51.18 Functionality added or changed: + * Added FLAG_MULTI_STATEMENTS to allow issuing queries that contain + multiple statements. Also added to the setup GUI. (Bug #7445) * Removed support for the TRACE and TRACEFILE DSN options. The standard ODBC logging should be used. Index: setup/MYODBCSetupDataSourceTab3.cpp =================================================================== --- setup/MYODBCSetupDataSourceTab3.cpp (revision 607) +++ setup/MYODBCSetupDataSourceTab3.cpp (working copy) @@ -98,6 +98,8 @@ nFlags |= 1 << 22; if ( ptab3a->pcheckboxAutoIncrementIsNull->isChecked() ) nFlags |= 1 << 23; + if ( ptab3c->pcheckboxMultiStatements->isChecked() ) + nFlags |= 1 << 26; return nFlags; } Index: setup/MYODBCSetupDataSourceDialog.cpp =================================================================== --- setup/MYODBCSetupDataSourceDialog.cpp (revision 607) +++ setup/MYODBCSetupDataSourceDialog.cpp (working copy) @@ -422,6 +422,7 @@ ptab3->ptab3c->pcheckboxForceUseOfForwardOnlyCursors->setChecked( nOptions & (1 << 21) ? TRUE : FALSE ); ptab3->ptab3a->pcheckboxEnableReconnect->setChecked( nOptions & (1 << 22) ? TRUE : FALSE ); ptab3->ptab3a->pcheckboxAutoIncrementIsNull->setChecked( nOptions & (1 << 23) ? TRUE : FALSE ); + ptab3->ptab3c->pcheckboxMultiStatements->setChecked( nOptions & (1 << 26) ? TRUE : FALSE ); } connect( ppushbuttonTest, SIGNAL(clicked()), SLOT(slotTest()) ); @@ -467,6 +468,7 @@ connect( ptab3->ptab3c->pcheckboxReadOptionsFromMyCnf, SIGNAL(signalAssistText(const QString&)), ptextbrowserAssist, SLOT(setHtml(const QString&)) ); connect( ptab3->ptab3c->pcheckboxDisableTransactions, SIGNAL(signalAssistText(const QString&)), ptextbrowserAssist, SLOT(setHtml(const QString&)) ); connect( ptab3->ptab3c->pcheckboxForceUseOfForwardOnlyCursors, SIGNAL(signalAssistText(const QString&)), ptextbrowserAssist, SLOT(setHtml(const QString&)) ); + connect( ptab3->ptab3c->pcheckboxMultiStatements, SIGNAL(signalAssistText(const QString&)), ptextbrowserAssist, SLOT(setHtml(const QString&)) ); connect( ptab3->ptab3d->pcheckboxTraceDriverCalls, SIGNAL(signalAssistText(const QString&)), ptextbrowserAssist, SLOT(setHtml(const QString&)) ); connect( ptab3->ptab3d->pcheckboxSaveQueries, SIGNAL(signalAssistText(const QString&)), ptextbrowserAssist, SLOT(setHtml(const QString&)) ); Index: setup/MYODBCSetupDataSourceTab3c.h =================================================================== --- setup/MYODBCSetupDataSourceTab3c.h (revision 607) +++ setup/MYODBCSetupDataSourceTab3c.h (working copy) @@ -48,6 +48,7 @@ MYODBCSetupCheckBox *pcheckboxReadOptionsFromMyCnf; MYODBCSetupCheckBox *pcheckboxDisableTransactions; MYODBCSetupCheckBox *pcheckboxForceUseOfForwardOnlyCursors; + MYODBCSetupCheckBox *pcheckboxMultiStatements; }; #endif Index: setup/MYODBCSetupDataSourceTab3c.cpp =================================================================== --- setup/MYODBCSetupDataSourceTab3c.cpp (revision 607) +++ setup/MYODBCSetupDataSourceTab3c.cpp (working copy) @@ -30,6 +30,7 @@ QString stringReadOptionsFromMyCnf( tr("Read parameters from the [client] and [odbc] groups from `my.cnf'.") ); QString stringDisableTransactions( tr("Disable transactions.") ); QString stringForceUseOfForwardOnlyCursors( tr("Force the use of Forward-only cursor type. In case of applications setting the default static/dynamic cursor type, and one wants driver to use non-cache result sets, then this option will ensure the forward-only cursor behavior.") ); + QString stringMultiStatements( tr("Allow multiple statements in a single query.") ); #if QT_VERSION >= 0x040000 QVBoxLayout *playoutFields = new QVBoxLayout; @@ -105,6 +106,15 @@ QToolTip::add( pcheckboxForceUseOfForwardOnlyCursors, stringForceUseOfForwardOnlyCursors ); #endif + pcheckboxMultiStatements = new MYODBCSetupCheckBox( tr("Allow multiple statements"), this ); + pcheckboxMultiStatements->setAssistText( stringMultiStatements ); + playoutFields->addWidget( pcheckboxMultiStatements ); +#if QT_VERSION >= 0x040000 + pcheckboxMultiStatements->setToolTip( stringMultiStatements ); +#else + QToolTip::add( pcheckboxMultiStatements, stringMultiStatements ); +#endif + playoutFields->addStretch( 10 ); }