Date: Wednesday, January 18, 2006 @ 15:27:55
  Author: zsolt
    Path: /cvsroot/carob/libmysequoia/test

Modified: TestMySQLAPI.cpp (1.23 -> 1.24)

extended test mysql_stmt_select_fetch_test() to handle "date" result


------------------+
 TestMySQLAPI.cpp |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)


Index: libmysequoia/test/TestMySQLAPI.cpp
diff -u libmysequoia/test/TestMySQLAPI.cpp:1.23 
libmysequoia/test/TestMySQLAPI.cpp:1.24
--- libmysequoia/test/TestMySQLAPI.cpp:1.23     Wed Jan 18 12:30:02 2006
+++ libmysequoia/test/TestMySQLAPI.cpp  Wed Jan 18 15:27:55 2006
@@ -378,9 +378,9 @@
 {
   MYSQL_STMT *stmt;
   MYSQL_BIND inbind[1];
-  MYSQL_BIND outbind[1];
+  MYSQL_BIND outbind[2];
   int int_data;
-  char *query = "select a from t1 where a <= ?";
+  char *query = "select a,d from t1 where a <= ?";
 
   CPPUNIT_ASSERT(mysql_real_connect(mysql, HOST, USER1, PASSWD1, DB1, 0, 0, 0) 
!= 0);
   CPPUNIT_ASSERT((stmt = mysql_stmt_init(mysql)) != 0);
@@ -396,20 +396,28 @@
   
   int_data = 3;
   CPPUNIT_ASSERT(mysql_stmt_execute(stmt) == 0);
-  CPPUNIT_ASSERT(mysql_stmt_field_count(stmt) == 1);
+  CPPUNIT_ASSERT(mysql_stmt_field_count(stmt) == 2);
 
   int int_res;
+  MYSQL_TIME date;
   my_bool isnull;
   
-  memset(outbind, 0, sizeof(inbind));
+  memset(outbind, 0, sizeof(outbind));
   outbind[0].buffer_type= MYSQL_TYPE_LONG;
   outbind[0].buffer= (char *)&int_res;
   outbind[0].is_null= &isnull;
+  outbind[1].buffer_type= MYSQL_TYPE_DATE;
+  outbind[1].buffer= (char *)&date;
   CPPUNIT_ASSERT(mysql_stmt_bind_result(stmt, outbind) == 0);
 
-  int count = 1;
+  unsigned int count = 1;
   while (mysql_stmt_fetch(stmt) == 0)
-    CPPUNIT_ASSERT(count++ == int_res);
+  {
+    CPPUNIT_ASSERT(date.year == 2006);
+    CPPUNIT_ASSERT(date.month == 1);
+    CPPUNIT_ASSERT(date.day == count);
+    CPPUNIT_ASSERT(count++ == (unsigned int)int_res);
+  }
 
   CPPUNIT_ASSERT(mysql_stmt_num_rows(stmt) == 3);
   CPPUNIT_ASSERT(mysql_stmt_affected_rows(stmt) == 3);

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to