Date: Friday, October 27, 2006 @ 16:37:40
Author: csaba
Path: /cvsroot/carob/libmysequoia/test
Modified: TestMySQLAPI.cpp (1.43 -> 1.44) TestMySQLAPI.hpp (1.19 -> 1.20)
Test case for LMS-29
------------------+
TestMySQLAPI.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++
TestMySQLAPI.hpp | 2 ++
2 files changed, 46 insertions(+)
Index: libmysequoia/test/TestMySQLAPI.cpp
diff -u libmysequoia/test/TestMySQLAPI.cpp:1.43
libmysequoia/test/TestMySQLAPI.cpp:1.44
--- libmysequoia/test/TestMySQLAPI.cpp:1.43 Fri Oct 20 20:40:52 2006
+++ libmysequoia/test/TestMySQLAPI.cpp Fri Oct 27 16:37:40 2006
@@ -1077,3 +1077,47 @@
CPPUNIT_ASSERT(mysql_stmt_close(stmt) == 0);
}
+
+void TestMySQLAPI::bug_lms_29_test(void)
+{
+ MYSQL_RES *res = 0;
+ int rows_fetched = 0;
+
+ CPPUNIT_ASSERT(mysql_real_connect(mysql, HOST, USER1, PASSWD1, DB1, 0, 0, 0)
!= 0);
+
+ mysql_query(mysql, "drop table t1");
+ CPPUNIT_ASSERT(mysql_query(mysql, "create table t1 (a int) engine=InnoDB")
== 0);
+
+ CPPUNIT_ASSERT(mysql_query(mysql, "set autocommit = 0") == 0);
+ CPPUNIT_ASSERT(mysql_query(mysql, "insert into t1 values (1)") == 0);
+ CPPUNIT_ASSERT(mysql_query(mysql, "commit") == 0);
+
+ CPPUNIT_ASSERT(mysql_query(mysql, "set autocommit = 1") == 0);
+ CPPUNIT_ASSERT(mysql_query(mysql, "insert into t1 values (2)") == 0);
+ CPPUNIT_ASSERT(mysql_query(mysql, "insert into t1 values (3)") == 0);
+
+ CPPUNIT_ASSERT(mysql_query(mysql, "set autocommit = 0") == 0);
+ CPPUNIT_ASSERT(mysql_query(mysql, "insert into t1 values(4)") == 0);
+ CPPUNIT_ASSERT(mysql_query(mysql, "rollback") == 0);
+
+ CPPUNIT_ASSERT(mysql_query(mysql, "set autocommit = 1") == 0);
+ CPPUNIT_ASSERT(mysql_query(mysql, "insert into t1 values (5)") == 0);
+ CPPUNIT_ASSERT(mysql_query(mysql, "insert into t1 values (6)") == 0);
+
+ CPPUNIT_ASSERT(mysql_query(mysql, "set autocommit = 0") == 0);
+ CPPUNIT_ASSERT(mysql_query(mysql, "insert into t1 values (7)") == 0);
+ CPPUNIT_ASSERT(mysql_query(mysql, "commit") == 0);
+
+ CPPUNIT_ASSERT(mysql_query(mysql, "set autocommit = 1") == 0);
+ CPPUNIT_ASSERT(mysql_query(mysql, "select * from t1") == 0);
+
+ CPPUNIT_ASSERT((res = mysql_store_result(mysql)) != 0);
+ while (mysql_fetch_row(res) != 0)
+ rows_fetched++;
+
+ // check how many rows we fetched
+ CPPUNIT_ASSERT(rows_fetched == 6);
+
+ // free the result set
+ mysql_free_result(res);
+}
Index: libmysequoia/test/TestMySQLAPI.hpp
diff -u libmysequoia/test/TestMySQLAPI.hpp:1.19
libmysequoia/test/TestMySQLAPI.hpp:1.20
--- libmysequoia/test/TestMySQLAPI.hpp:1.19 Fri Oct 20 20:40:52 2006
+++ libmysequoia/test/TestMySQLAPI.hpp Fri Oct 27 16:37:40 2006
@@ -66,6 +66,7 @@
CPPUNIT_TEST (bug_lms_24_test);
CPPUNIT_TEST (bug_lms_27_test);
CPPUNIT_TEST (bug_lms_28_test);
+ CPPUNIT_TEST (bug_lms_29_test);
CPPUNIT_TEST_SUITE_END ();
public:
@@ -109,6 +110,7 @@
void bug_lms_24_test(void);
void bug_lms_27_test(void);
void bug_lms_28_test(void);
+ void bug_lms_29_test(void);
private:
MYSQL *mysql;
};
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits