List:Commits« Previous MessageNext Message »
From:sebrecht Date:June 19 2007 7:52pm
Subject:ODBC C-tests commit: r152 - trunk/testsuites/t_bug_foreign_key
View as plain text  
Modified:
   trunk/testsuites/t_bug_foreign_key/bug19923.c
   trunk/testsuites/t_bug_foreign_key/t_bug_foreign_key.h
   trunk/testsuites/t_bug_foreign_key/t_bug_foreign_key_suite.c
Log:
add test for bug19923


Modified: trunk/testsuites/t_bug_foreign_key/bug19923.c
===================================================================
--- trunk/testsuites/t_bug_foreign_key/bug19923.c	2007-06-15 13:09:21 UTC (rev 151)
+++ trunk/testsuites/t_bug_foreign_key/bug19923.c	2007-06-19 17:52:06 UTC (rev 152)
@@ -13,100 +13,68 @@
    
    ****************************************** */
 
-OT_TEST_METHOD(createdatabase)
-{
-  SQLHANDLE stmt= get_statement();
-  char *qry1= "drop database if exists odbc_fk";
-  char *qry2= "create database odbc_fk";
-  OT_SKIP("The whole testsuite is skipped at the moment");
-  CHECK_SQL_S(SQLExecDirect(stmt, (SQLCHAR *)qry1, SQL_NTS), stmt);
-  reset_statement(stmt);
-  CHECK_SQL_S(SQLExecDirect(stmt, (SQLCHAR *)qry2, SQL_NTS), stmt);
-  free_statement(stmt);
-  test_printf("database odbc_fk is created\n");
-}
-
 OT_TEST_METHOD(createtable)
 {
-  OT_SKIP("The whole testsuite is skipped at the moment");
   SQLHANDLE stmt= get_statement();
-  char *qry1= "create table abc ( "
-    "id char(4) not null, "
-    "name varchar(40) not null, "
+  char *qry1= "create table if not exists bug19923a ( "
+    "id integer not null, "
+    "number integer, "
     "primary key(id) "
     ") engine=innodb default charset=latin1";
-  char *qry2= "create table def ( "
-    "id varchar(6) not null, "
-    "title varchar(80) not null, "
-    "store char(4) not null, "
-    "note varchar(200) not null, "
+  char *qry2= "create table if not exists bug19923b ( "
+    "id integer not null, "
+    "a_id integer not null, "
+    "number integer, "
     "primary key(id), "
-    "foreign key(store) references abc (id) "
+    "foreign key(a_id) references bug19923a(id) "
     ") engine=innodb default charset=latin1";
-  char *qry3= "create index ind_title on def(title)";
-  char *qry4= "create table ghi ( "
-    "id char(4) not null, "
-    "store char(4) not null, "
-    "title varchar(6) not null, "
-    "note varchar(200) not null, "
-    "primary key(store, id, title), "
-    "foreign key(store) references abc(id), "
-    "foreign key(title) references def(id) "
+  char *qry3= "create table if not exists bug19923c ( "
+    "id integer not null, "
+    "a_id integer not null, "
+    "b_id integer not null, "
+    "number integer, "
+    "primary key(id), "
+    "foreign key(a_id) references bug19923a(id), "
+    "foreign key(b_id) references bug19923b(id) "
     ") engine=innodb default charset=latin1";
-  char *qry5= "create index ind_titleid on ghi(title)";
-
+  
+  /* TC_SET_TXMODE(get_dbc_handle(), SQL_AUTOCOMMIT_OFF); */
   CHECK_SQL_S(SQLExecDirect(stmt, (SQLCHAR *)qry1, SQL_NTS), stmt);
-  reset_statement(stmt);
   CHECK_SQL_S(SQLExecDirect(stmt, (SQLCHAR *)qry2, SQL_NTS), stmt);
-  reset_statement(stmt);
   CHECK_SQL_S(SQLExecDirect(stmt, (SQLCHAR *)qry3, SQL_NTS), stmt);
-  reset_statement(stmt);
-  CHECK_SQL_S(SQLExecDirect(stmt, (SQLCHAR *)qry4, SQL_NTS), stmt);
-  reset_statement(stmt);
-  CHECK_SQL_S(SQLExecDirect(stmt, (SQLCHAR *)qry5, SQL_NTS), stmt);
+  /* TC_FINISH_TX(get_dbc_handle(), SQL_COMMIT); */
+  /* TC_SET_TXMODE(get_dbc_handle(), SQL_AUTOCOMMIT_ON); */
   free_statement(stmt);
 }
 
 OT_TEST_METHOD(bug19923)
 {
-  SQLRETURN   rc;
-  SQLLEN len;
-  SQLCHAR rslt[5][STRLEN];
+  SQLRETURN rc;
   SQLHANDLE stmt= get_statement();
-  int i=0;
-  OT_SKIP("Test not finished ...");
   CHECK_SQL_S(SQLForeignKeys(stmt,
 			     NULL, 0,
 			     NULL, 0,
 			     NULL, 0,
 			     NULL, 0,
 			     NULL, 0,
-			     (SQLCHAR *)"ghi", SQL_NTS),stmt);
+			     (SQLCHAR *)"bug19923b", SQL_NTS),stmt);
 
-  CHECK_SQL_S(SQLFetch(stmt), stmt);
-  CHECK_SQL_S(SQLGetData(stmt, 3, SQL_C_CHAR,
-                           rslt[0], STRLEN, &len), stmt);
-  CHECK_SQL_S(SQLGetData(stmt, 4, SQL_C_CHAR,
-                           rslt[1], STRLEN, &len), stmt);
-  CHECK_SQL_S(SQLGetData(stmt, 7, SQL_C_CHAR,
-                           rslt[2], STRLEN, &len), stmt);
-  CHECK_SQL_S(SQLGetData(stmt, 8, SQL_C_CHAR,
-                           rslt[3], STRLEN, &len), stmt);
-  CHECK_SQL_S(SQLGetData(stmt, 12, SQL_C_CHAR,
-                           rslt[4], STRLEN, &len), stmt);
+  if((rc= SQLFetch(stmt)) == SQL_NO_DATA)
+    OT_FAIL("The bug isn't fixed !");
+  else
+    OT_TODO("Code is missing. The test need to be finished");
   free_statement(stmt);
-
-  for(i=0; i<5; ++i) test_printf("%d - %s\n",i,rslt[i]);
-
-  
 }
 
-OT_TEST_METHOD(dropdatabase)
+OT_TEST_METHOD(droptable)
 {
   SQLHANDLE stmt= get_statement();
-  char *qry= "drop database if exists odbc_fk";
-  OT_SKIP("The whole testsuite is skipped at the moment");
-  CHECK_SQL_S(SQLExecDirect(stmt, (SQLCHAR *)qry, SQL_NTS), stmt);
-  free_statement(stmt);
-  test_printf("database odbc_fk is dropped\n");
+  char *qry1= "drop table if exists bug19923c";
+  char *qry2= "drop table if exists bug19923b";
+  char *qry3= "drop table if exists bug19923a";
+
+  CHECK_SQL_S(SQLExecDirect(stmt, (SQLCHAR *)qry1, SQL_NTS), stmt);
+  CHECK_SQL_S(SQLExecDirect(stmt, (SQLCHAR *)qry2, SQL_NTS), stmt);
+  CHECK_SQL_S(SQLExecDirect(stmt, (SQLCHAR *)qry3, SQL_NTS), stmt);
+  free_statement(stmt); 
 }

Modified: trunk/testsuites/t_bug_foreign_key/t_bug_foreign_key.h
===================================================================
--- trunk/testsuites/t_bug_foreign_key/t_bug_foreign_key.h	2007-06-15 13:09:21 UTC (rev
151)
+++ trunk/testsuites/t_bug_foreign_key/t_bug_foreign_key.h	2007-06-19 17:52:06 UTC (rev
152)
@@ -6,7 +6,6 @@
 extern const int TD_ALLTYPES_COLS;
 
 /* create tests */
-OT_TEST_METHOD(createdatabase);
 OT_TEST_METHOD(createtable);
 OT_TEST_METHOD(bug19923);
-OT_TEST_METHOD(dropdatabase);
+OT_TEST_METHOD(droptable);

Modified: trunk/testsuites/t_bug_foreign_key/t_bug_foreign_key_suite.c
===================================================================
--- trunk/testsuites/t_bug_foreign_key/t_bug_foreign_key_suite.c	2007-06-15 13:09:21 UTC
(rev 151)
+++ trunk/testsuites/t_bug_foreign_key/t_bug_foreign_key_suite.c	2007-06-19 17:52:06 UTC
(rev 152)
@@ -16,9 +16,8 @@
 
 OT_SUITE_REGISTER_START("bug_foreign_key",bug_foreign_key_suite_setup,bug_foreign_key_suite_teardown)
 /* create tests */
-     OT_SUITE_ADD_TEST(createdatabase, NULL, NULL);
      OT_SUITE_ADD_TEST(createtable, NULL, NULL);
      OT_SUITE_ADD_TEST(bug19923, NULL, NULL);
-     OT_SUITE_ADD_TEST(dropdatabase, NULL, NULL);
+     OT_SUITE_ADD_TEST(droptable, NULL, NULL);
 OT_SUITE_REGISTER_END
 

Thread
ODBC C-tests commit: r152 - trunk/testsuites/t_bug_foreign_keysebrecht19 Jun