Date: Tuesday, July 11, 2006 @ 16:56:07
Author: csaba
Path: /cvsroot/carob/libmysequoia
Modified: src/CarobMySQL.cpp (1.76 -> 1.77) test/Globals.hpp (1.3 -> 1.4)
test/TestMySQLAPI.cpp (1.36 -> 1.37)
Tailor the test suite settings to the Grenoble environment.
-----------------------+
src/CarobMySQL.cpp | 6 ++++++
test/Globals.hpp | 13 ++++++-------
test/TestMySQLAPI.cpp | 41 +++++++----------------------------------
3 files changed, 19 insertions(+), 41 deletions(-)
Index: libmysequoia/src/CarobMySQL.cpp
diff -u libmysequoia/src/CarobMySQL.cpp:1.76
libmysequoia/src/CarobMySQL.cpp:1.77
--- libmysequoia/src/CarobMySQL.cpp:1.76 Fri Jun 23 10:22:00 2006
+++ libmysequoia/src/CarobMySQL.cpp Tue Jul 11 16:56:07 2006
@@ -268,6 +268,10 @@
{
result = connect(mysqlPtr->host, mysqlPtr->user, mysqlPtr->passwd, db,
mysqlPtr->port, 0, mysqlPtr->client_flag);
+ /*
+ * Do we need to send it out?
+ * the vdb name doesn't need to be the same as
+ * the db name
if (result)
{
char buff[120];
@@ -275,6 +279,8 @@
snprintf(buff, sizeof(buff), "use %s", db);
result = real_query(buff, strlen(buff), false);
}
+ */
+
}
else
{
Index: libmysequoia/test/Globals.hpp
diff -u libmysequoia/test/Globals.hpp:1.3 libmysequoia/test/Globals.hpp:1.4
--- libmysequoia/test/Globals.hpp:1.3 Mon Jan 2 13:19:56 2006
+++ libmysequoia/test/Globals.hpp Tue Jul 11 16:56:07 2006
@@ -22,15 +22,14 @@
#ifndef _GLOBALS_HPP
#define _GLOBALS_HPP
-const char *USER1 = "user1";
-const char *PASSWD1 = "userpass1";
-const char *USER2 = "user2";
-const char *PASSWD2 = "userpass2";
+const char *USER1 = "realuser";
+const char *PASSWD1 = "realuser";
+const char *USER2 = "cts1";
+const char *PASSWD2 = "cts1";
const char *BAD_USER = "nonexistent_user_name";
const char *BAD_PASSWD = "bad_password";
-const char *HOST = "localhost";
-const char *DB1 = "db1";
-const char *DB2 = "db2";
+const char *HOST = "n1 n2";
+const char *DB1 = "DB1";
const char *BAD_DB = "nonexistent_db_name";
const char *SOCKET = "/var/run/mysqld/mysqld.sock";
Index: libmysequoia/test/TestMySQLAPI.cpp
diff -u libmysequoia/test/TestMySQLAPI.cpp:1.36
libmysequoia/test/TestMySQLAPI.cpp:1.37
--- libmysequoia/test/TestMySQLAPI.cpp:1.36 Mon Apr 10 09:34:50 2006
+++ libmysequoia/test/TestMySQLAPI.cpp Tue Jul 11 16:56:07 2006
@@ -61,27 +61,6 @@
CPPUNIT_ASSERT(mysql->passwd && strcmp(PASSWD1, mysql->passwd) == 0);
CPPUNIT_ASSERT(mysql->db && strcmp(DB1, mysql->db) == 0);
CPPUNIT_ASSERT(mysql->port != 0);
-
- // connect without the hostname parameter
- // implicit localhost
- CPPUNIT_ASSERT(mysql_real_connect(mysql, "", USER1, PASSWD1, DB1, 0, 0, 0)
!= 0);
- CPPUNIT_ASSERT(mysql_real_connect(mysql, 0, USER1, PASSWD1, DB1, 0, 0, 0) !=
0);
- CPPUNIT_ASSERT(mysql->host && strcmp("localhost", mysql->host) == 0);
-
- // connect without the username parameter
- // implicit the current login name under unix
-/* TODO uncomment when the code will be in place
- CPPUNIT_ASSERT(mysql_real_connect(mysql, HOST, "", PASSWD1, DB1, 0, 0, 0) !=
0);
- CPPUNIT_ASSERT(mysql_real_connect(mysql, HOST, 0, PASSWD1, DB1, 0, 0, 0) !=
0);
- char *user = getenv("USER");
- CPPUNIT_ASSERT(mysql->user && strcmp(user ? user : "UNKNOWN_USER",
mysql->user));
-*/
- // connect with an empty password
-/* TODO put in the config file an username with an empty password and uncoment
- the test
- CPPUNIT_ASSERT(mysql_real_connect(mysql, HOST, USER1, "", DB1, 0, 0, 0) !=
0);
- CPPUNIT_ASSERT(mysql_real_connect(mysql, HOST, USER1, 0, DB1, 0, 0, 0) !=
0);
-*/
}
void TestMySQLAPI::mysql_real_connect_negative_test(void)
@@ -114,11 +93,6 @@
// connect specifying every parameter
CPPUNIT_ASSERT(mysql_connect(mysql, HOST, USER1, PASSWD1) != 0);
-
- // connect without the hostname parameter
- // implicit localhost
- CPPUNIT_ASSERT(mysql_connect(mysql, "", USER1, PASSWD1) != 0);
- CPPUNIT_ASSERT(mysql_connect(mysql, 0, USER1, PASSWD1) != 0);
}
#endif
@@ -129,17 +103,13 @@
CPPUNIT_ASSERT(mysql->host && strcmp(HOST, mysql->host) == 0);
CPPUNIT_ASSERT(mysql->user && strcmp(USER1, mysql->user) == 0);
CPPUNIT_ASSERT(mysql->passwd && strcmp(PASSWD1, mysql->passwd) == 0);
- // CPPUNIT_ASSERT(mysql->db == 0);
- // CPPUNIT_ASSERT(mysql->port != 0);
+ CPPUNIT_ASSERT(mysql->db == 0);
+ CPPUNIT_ASSERT(mysql->port != 0);
// select DB1 - the real connection will happen here
// be aware 0 - success
CPPUNIT_ASSERT(mysql_select_db(mysql, DB1) == 0);
CPPUNIT_ASSERT(mysql->db && strcmp(DB1, mysql->db) == 0);
-
- // select DB2 - reconnect will happen - be aware 0 - success
- CPPUNIT_ASSERT(mysql_select_db(mysql, DB2) == 0);
- CPPUNIT_ASSERT(mysql->db && strcmp(DB2, mysql->db) == 0);
}
void TestMySQLAPI::mysql_select_db_negative_test(void)
@@ -445,6 +415,9 @@
{
MYSQL_RES *res;
+ // for this test to pass the allowMultiQueries=true option
+ // must be set in the JDBC URL of the vdb file
+
// connect to the database and execute the queries
CPPUNIT_ASSERT(mysql_real_connect(mysql, HOST, USER1, PASSWD1, DB1, 0, 0, 0)
!= 0);
CPPUNIT_ASSERT(mysql_query(mysql, "select * from t1 limit 1; select * from
t1 limit 2; select * from t1 limit 3") == 0);
@@ -939,12 +912,12 @@
CPPUNIT_ASSERT(mysql_stmt_bind_param(stmt, bind) == 0);
- i1 = -23;
+ i1 = 23;
i2 = 35999;
// i3 = NULL;
i4 = -500;
i5 = -9999999;
- i6 = -0;
+ i6 = 0;
i7 = 0;
CPPUNIT_ASSERT(mysql_stmt_execute(stmt) == 0);
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits