MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:jwinstead Date:August 27 2007 5:32pm
Subject:Connector/ODBC 3.51 commit: r700 - trunk/test
View as plain text  
Modified:
   trunk/test/my_basics.c
   trunk/test/my_curext.c
   trunk/test/my_cursor.c
   trunk/test/my_datetime.c
   trunk/test/my_error.c
   trunk/test/my_keys.c
   trunk/test/my_param.c
   trunk/test/my_prepare.c
   trunk/test/my_relative.c
   trunk/test/my_result.c
   trunk/test/my_scroll.c
   trunk/test/my_types.c
Log:
Fix all tests to clean up tables that they have created


Modified: trunk/test/my_basics.c
===================================================================
--- trunk/test/my_basics.c	2007-08-27 16:38:56 UTC (rev 699)
+++ trunk/test/my_basics.c	2007-08-27 17:32:50 UTC (rev 700)
@@ -311,6 +311,8 @@
   ok_con(hdbc1, SQLDisconnect(hdbc1));
   ok_con(hdbc1, SQLFreeHandle(SQL_HANDLE_DBC, hdbc1));
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_bug19345");
+
   return OK;
 }
 

Modified: trunk/test/my_curext.c
===================================================================
--- trunk/test/my_curext.c	2007-08-27 16:38:56 UTC (rev 699)
+++ trunk/test/my_curext.c	2007-08-27 17:32:50 UTC (rev 700)
@@ -30,8 +30,7 @@
     SQLLEN      int_pcbValue, pcbValue, pcbValue1, pcbValue2;
     SQLCHAR     szData[255]={0};
 
-    /* initialize data */
-    SQLExecDirect(hstmt,"drop table my_pcbValue",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS my_pcbValue");
 
     rc = SQLExecDirect(hstmt,"create table my_pcbValue(id int, name varchar(30),\
                                                        name1 varchar(30),\
@@ -145,6 +144,8 @@
     SQLFreeStmt(hstmt, SQL_UNBIND);
     SQLFreeStmt(hstmt, SQL_CLOSE);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS my_pcbValue");
+
   return OK;
 }
 
@@ -158,8 +159,7 @@
     SQLLEN      int_pcbValue, pcbValue, pcbValue1, pcbValue2;
     SQLCHAR     szData[255]={0};
 
-    /* initialize data */
-    SQLExecDirect(hstmt,"drop table my_pcbValue_add",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS my_pcbValue_add");
 
     rc = SQLExecDirect(hstmt,"create table my_pcbValue_add(id int, name varchar(30),\
                                                        name1 varchar(30),\
@@ -276,6 +276,8 @@
     SQLFreeStmt(hstmt, SQL_UNBIND);
     SQLFreeStmt(hstmt, SQL_CLOSE);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS my_pcbValue_add");
+
   return OK;
 }
 
@@ -285,13 +287,8 @@
 {
     SQLRETURN   rc;
 
-    /* initialize data */
-    rc = SQLExecDirect(hstmt,"DROP TABLE IF EXISTS TestColNames",SQL_NTS);
-    mystmt(hstmt,rc);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS TestColNames");
 
-    rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
-    mycon(hdbc,rc);
-
     rc = SQLExecDirect(hstmt,"CREATE TABLE `TestColNames`(`Value One` text,\
                                                            `Value Two` text,\
                                                            `Value Three` text)",SQL_NTS);
@@ -341,8 +338,7 @@
     SQLLEN      pcbValue;
     SQLCHAR     szData[255]={0};
 
-    /* initialize data */
-    SQLExecDirect(hstmt,"drop table my_empty_string",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS my_empty_string");
 
     rc = SQLExecDirect(hstmt,"create table my_empty_string(name varchar(30))",SQL_NTS);
     mystmt(hstmt,rc);
@@ -373,6 +369,8 @@
     SQLFreeStmt(hstmt, SQL_UNBIND);
     SQLFreeStmt(hstmt, SQL_CLOSE);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS my_empty_string");
+
   return OK;
 }
 

Modified: trunk/test/my_cursor.c
===================================================================
--- trunk/test/my_cursor.c	2007-08-27 16:38:56 UTC (rev 699)
+++ trunk/test/my_cursor.c	2007-08-27 17:32:50 UTC (rev 700)
@@ -636,10 +636,11 @@
   SQLLEN row_count, cur_type;
   SQLUSMALLINT rgfRowStatus;
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_pos_delete");
+
     rc = SQLAllocStmt(hdbc,&hstmt1);
     mycon(hdbc,rc);
 
-    tmysql_exec(hstmt,"drop table t_pos_delete");
     rc = tmysql_exec(hstmt,"create table t_pos_delete(id int not null default '0',\
                                                       name varchar(20) NOT NULL default
'',\
                                                       created datetime NOT NULL default
'2000-01-01')");
@@ -753,6 +754,8 @@
     rc = SQLFreeStmt(hstmt1,SQL_DROP);
     mystmt(hstmt1,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_pos_delete");
+
   return OK;
 }
 
@@ -1043,7 +1046,7 @@
     SQLROWSETSIZE pcrow;
     SQLUSMALLINT rgfRowStatus;
 
-    tmysql_exec(hstmt,"drop table tmysql_setpos");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS tmysql_setpos");
     rc = tmysql_exec(hstmt,"create table tmysql_setpos(col1 int, col2 varchar(30))");
     mystmt(hstmt,rc);
 
@@ -1139,6 +1142,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS tmysql_setpos");
+
   return OK;
 }
 
@@ -1152,7 +1157,7 @@
     SQLROWSETSIZE pcrow;
     SQLUSMALLINT rgfRowStatus;
 
-    tmysql_exec(hstmt,"drop table tmysql_setpos_add");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS tmysql_setpos_add");
     rc = tmysql_exec(hstmt,"create table tmysql_setpos_add(col1 int, col2 varchar(30))");
     mystmt(hstmt,rc);
 
@@ -1234,6 +1239,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS tmysql_setpos_add");
+
   return OK;
 }
 
@@ -1638,8 +1645,7 @@
     SQLROWSETSIZE pcrow;
     SQLUSMALLINT rgfRowStatus;
 
-    tmysql_exec(hstmt,"drop table tmysql_t1");
-    tmysql_exec(hstmt,"drop table tmysql_t2");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS tmysql_t1, tmysql_t2");
     rc = tmysql_exec(hstmt,"create table tmysql_t1(col1 int, col2 varchar(20))");
     mystmt(hstmt,rc);
     rc = tmysql_exec(hstmt,"create table tmysql_t2(col1 int, col2 varchar(20))");
@@ -1697,6 +1703,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS tmysql_t1, tmysql_t2");
+
   return OK;
 }
 
@@ -1710,7 +1718,7 @@
     SQLROWSETSIZE pcrow;
     SQLUSMALLINT rgfRowStatus;
 
-    tmysql_exec(hstmt,"drop table tmysql_setpos1");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS tmysql_setpos1");
 
     rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
     mycon(hdbc,rc);
@@ -1778,6 +1786,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS tmysql_setpos1");
+
   return OK;
 }
 
@@ -1984,7 +1994,7 @@
     SQLSMALLINT pccol;
     SQLUSMALLINT rgfRowStatus;
 
-    tmysql_exec(hstmt,"drop table if exists t_setpos_upd_bug1");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_setpos_upd_bug1");
     rc = tmysql_exec(hstmt,"create table t_setpos_upd_bug1(id int(11) NOT NULL
auto_increment,\
                                                            fname char(20) NOT NULL
default '',\
                                                            lname char(20) NOT NULL
default '',\
@@ -2082,6 +2092,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_setpos_upd_bug1");
+
   return OK;
 }
 
@@ -2095,7 +2107,8 @@
     SQLROWSETSIZE pcrow;
     SQLUSMALLINT rgfRowStatus;
 
-    tmysql_exec(hstmt,"drop table my_setpos_upd_pk_order");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS my_setpos_upd_pk_order");
+
     rc = tmysql_exec(hstmt,"create table my_setpos_upd_pk_order(col1 int not null, col2
varchar(30) NOT NULL, primary key(col2,col1))");
     mystmt(hstmt,rc);
 
@@ -2164,6 +2177,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS my_setpos_upd_pk_order");
+
   return OK;
 }
 

Modified: trunk/test/my_datetime.c
===================================================================
--- trunk/test/my_datetime.c	2007-08-27 16:38:56 UTC (rev 699)
+++ trunk/test/my_datetime.c	2007-08-27 17:32:50 UTC (rev 700)
@@ -130,7 +130,7 @@
     ts.second = 45;
     ts.fraction = 05;   
 
-    tmysql_exec(hstmt,"drop table t_tstotime");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_tstotime");
 
     rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
     mycon(hdbc,rc);
@@ -183,6 +183,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_tstotime");
+
   return OK;
 }
 
@@ -225,6 +227,8 @@
   ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_RESET_PARAMS));
   ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE));
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_tstotime1");
+
   return OK;
 }
 
@@ -279,7 +283,7 @@
   SQL_TIME_STRUCT tm;
   SQLCHAR         str[20];
 
-    tmysql_exec(hstmt,"drop table t_time");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_time");
     rc = tmysql_exec(hstmt,"create table t_time(tm time, ts timestamp(14))");
     mystmt(hstmt,rc);
 
@@ -333,6 +337,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_time");
+
   return OK;
 }
 
@@ -345,7 +351,7 @@
   SQLCHAR         data[30];
   SQLLEN          length;
 
-    SQLExecDirect(hstmt,"drop table t_time",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_time");
     rc = SQLExecDirect(hstmt,"create table t_time(t time, t1 timestamp, t2 datetime, t3
date)",SQL_NTS);
     mystmt(hstmt,rc);
 
@@ -602,6 +608,8 @@
     SQLFreeStmt(hstmt, SQL_UNBIND);
     SQLFreeStmt(hstmt, SQL_CLOSE);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_time");
+
   return OK;
 }
 

Modified: trunk/test/my_error.c
===================================================================
--- trunk/test/my_error.c	2007-08-27 16:38:56 UTC (rev 699)
+++ trunk/test/my_error.c	2007-08-27 17:32:50 UTC (rev 700)
@@ -222,6 +222,8 @@
   ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_UNBIND));
   ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE));
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_warning");
+
   return OK;
 }
 

Modified: trunk/test/my_keys.c
===================================================================
--- trunk/test/my_keys.c	2007-08-27 16:38:56 UTC (rev 699)
+++ trunk/test/my_keys.c	2007-08-27 17:32:50 UTC (rev 700)
@@ -30,8 +30,7 @@
     SQLROWCOUNT rowcount;
     SQLINTEGER nData;
 
-    /* INIT */
-    SQLExecDirect(hstmt,"drop table my_no_keys",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS my_no_keys");
     rc = SQLExecDirect(hstmt,"create table my_no_keys(col1 int,\
                                                       col2 varchar(30),\
                                                       col3 int,\
@@ -128,6 +127,8 @@
     SQLFreeStmt(hstmt,SQL_UNBIND);
     SQLFreeStmt(hstmt,SQL_CLOSE);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS my_no_keys");
+
   return OK;
 }
 

Modified: trunk/test/my_param.c
===================================================================
--- trunk/test/my_param.c	2007-08-27 16:38:56 UTC (rev 699)
+++ trunk/test/my_param.c	2007-08-27 17:32:50 UTC (rev 700)
@@ -239,25 +239,9 @@
 {
     SQLRETURN rc;
 
-    /* dump based */
-    printMessage("table structure for 'shop'..\n");
-    tmysql_exec(hstmt,"drop table if exists shop");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS tmysql_err");
 
-    rc = tmysql_exec(hstmt,"CREATE TABLE shop (\
-                valor varchar(20) NOT NULL default ''\
-                ) TYPE=MyISAM;");
-    mystmt(hstmt,rc);
-
-    rc = tmysql_exec(hstmt,"LOCK TABLES shop WRITE");
-    mystmt(hstmt,rc);
-
-    rc = tmysql_exec(hstmt,"UNLOCK TABLES");
-    mystmt(hstmt,rc);
-
-    printMessage("table structure for 'sqlerr'..\n");
-    tmysql_exec(hstmt,"drop table if exists sqlerr");
-
-    rc = tmysql_exec(hstmt,"CREATE TABLE sqlerr (\
+    rc = tmysql_exec(hstmt,"CREATE TABLE tmysql_err (\
                   td date NOT NULL default '0000-00-00',\
                   node varchar(8) NOT NULL default '',\
                   tag varchar(10) NOT NULL default '',\
@@ -268,10 +252,7 @@
                 ) TYPE=MyISAM");
     mystmt(hstmt,rc);
 
-    printMessage("dump data for table 'sqlerr'..\n");
-    rc = tmysql_exec(hstmt,"LOCK TABLES sqlerr WRITE");
-    mystmt(hstmt,rc);
-    rc = tmysql_exec(hstmt,"INSERT INTO sqlerr VALUES\
+    rc = tmysql_exec(hstmt,"INSERT INTO tmysql_err VALUES\
                   ('0000-00-00','0','0','0','0','0','0'),\
                   ('2001-08-29','FIX','SQLT2','ins1',\
                   NULL,NULL, 'Error.  SQL cmd %s is not terminated or too long.'),\
@@ -292,30 +273,6 @@
                   ('0000-00-00','0','0','0','0','0','0'),('2001-08-29','FIX','SQLT2',\
                   'ins1',NULL,NULL,'Error.  SQL cmd %s is not terminated or too
long.')");
 
-    rc = tmysql_exec(hstmt,"UNLOCK TABLES");
-    mystmt(hstmt,rc);
-
-    printMessage("table structure for 'sqllib'..\n");
-    tmysql_exec(hstmt,"drop table if exists sqllib");
-
-    rc = tmysql_exec(hstmt,"CREATE TABLE sqllib (\
-                  sqlname varchar(8) NOT NULL default '',\
-                  sqlcmd varchar(150) NOT NULL default '',\
-                  PRIMARY KEY  (sqlname)\
-                ) TYPE=MyISAM");
-    mystmt(hstmt,rc);
-
-    printMessage("dump data for 'sqllib'..\n");
-    rc = tmysql_exec(hstmt,"LOCK TABLES sqllib WRITE");
-    mystmt(hstmt,rc);
-    rc = tmysql_exec(hstmt,"INSERT INTO sqllib VALUES ('ins1','insert into shop (valor)
values(?)')");
-    mystmt(hstmt,rc);
-    rc = tmysql_exec(hstmt,"UNLOCK TABLES");
-    mystmt(hstmt,rc);
-
-    rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
-    mycon(hdbc,rc);
-
     /* trace based */
     {
         SQLSMALLINT pcpar,pccol,pfSqlType,pibScale,pfNullable;
@@ -330,7 +287,7 @@
         SQLULEN     pcbParamDef;
 
         SQLFreeStmt(hstmt,SQL_CLOSE);
-        rc = SQLPrepare(hstmt,"insert into sqlerr (TD, NODE, TAG, SQLNAME, SQL_ERR,
FIX_ERR, PROG_ERR)\
+        rc = SQLPrepare(hstmt,"insert into tmysql_err (TD, NODE, TAG, SQLNAME, SQL_ERR,
FIX_ERR, PROG_ERR)\
                          values (?, ?, ?, ?, ?, ?, ?)",200);
         mystmt(hstmt,rc);
 
@@ -369,6 +326,8 @@
         mystmt(hstmt,rc);
     }
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS tmysql_err");
+
   return OK;
 }
 

Modified: trunk/test/my_prepare.c
===================================================================
--- trunk/test/my_prepare.c	2007-08-27 16:38:56 UTC (rev 699)
+++ trunk/test/my_prepare.c	2007-08-27 17:32:50 UTC (rev 700)
@@ -31,7 +31,7 @@
     SQLLEN length1, length2, pcrow;
     char       name[20];
 
-    SQLExecDirect(hstmt,"drop table t_prep_basic",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_prep_basic");
 
     rc = SQLExecDirect(hstmt,"create table t_prep_basic(a int, b char(4))",SQL_NTS);
     mystmt(hstmt,rc);
@@ -81,6 +81,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_prep_basic");
+
   return OK;
 }
 
@@ -91,7 +93,7 @@
     SQLLEN length;
     char       buffer[20];
 
-    SQLExecDirect(hstmt,"drop table t_prep_buffer_length",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_prep_buffer_length");
 
     rc = SQLExecDirect(hstmt,"create table t_prep_buffer_length(a varchar(20))",SQL_NTS);
     mystmt(hstmt,rc);
@@ -176,6 +178,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_prep_buffer_length");
+
   return OK;
 }
 
@@ -186,9 +190,8 @@
     SQLLEN length, length1, pcrow;
     SQLCHAR    name[20], bin[10];
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_prep_truncate");
 
-    SQLExecDirect(hstmt,"drop table t_prep_truncate",SQL_NTS);
-
     rc = SQLExecDirect(hstmt,"create table t_prep_truncate(a int, b char(4), c
binary(4))",SQL_NTS);
     mystmt(hstmt,rc);
 
@@ -244,6 +247,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_prep_truncate");
+
   return OK;
 }
 
@@ -325,7 +330,7 @@
     SQLLEN     length;
     SQLCHAR    tiny;
 
-    SQLExecDirect(hstmt,"drop table t_prep_getdata",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_prep_getdata");
 
     rc = SQLExecDirect(hstmt,"create table t_prep_getdata(a tinyint, b int, c
char(4))",SQL_NTS);
     mystmt(hstmt,rc);
@@ -397,6 +402,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_prep_getdata");
+
   return OK;
 }
 
@@ -407,7 +414,7 @@
     SQLCHAR     data[11];
     SQLLEN length;
 
-    SQLExecDirect(hstmt,"drop table t_prep_getdata",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_prep_getdata");
 
     rc = SQLExecDirect(hstmt,"create table t_prep_getdata(a char(10), b int)",SQL_NTS);
     mystmt(hstmt,rc);
@@ -523,6 +530,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_prep_getdata");
+
   return OK;
 }
 
@@ -532,7 +541,7 @@
     SQLCHAR     table[20];
     SQLLEN      length;
 
-    SQLExecDirect(hstmt,"drop table t_prep_catalog",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_prep_catalog");
 
     rc = SQLExecDirect(hstmt,"create table t_prep_catalog(a int default 100)",SQL_NTS);
     mystmt(hstmt,rc);
@@ -593,6 +602,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_prep_catalog");
+
   return OK;
 }
 
@@ -611,10 +622,9 @@
     }
 */
 
-    SQLExecDirect(hstmt,"drop procedure t_sp",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_tabsp");
+  ok_sql(hstmt, "DROP PROCEDURE IF EXISTS t_sp");
 
-    SQLExecDirect(hstmt,"drop table t_tabsp",SQL_NTS);
-
     rc = SQLExecDirect(hstmt,"create table t_tabsp(a int, b varchar(10))",SQL_NTS);
     mystmt(hstmt,rc);
 
@@ -665,13 +675,9 @@
     SQLFreeStmt(hstmt, SQL_UNBIND);
     SQLFreeStmt(hstmt, SQL_CLOSE);
 
-    rc = SQLExecDirect(hstmt,"drop procedure t_sp",SQL_NTS);
-    mystmt(hstmt,rc);
+  ok_sql(hstmt, "DROP PROCEDURE IF EXISTS t_sp");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_tabsp");
 
-    rc = SQLExecDirect(hstmt,"drop table t_tabsp",SQL_NTS);
-    mystmt(hstmt,rc);
-    SQLFreeStmt(hstmt, SQL_CLOSE);
-
   return OK;
 }
 
@@ -684,10 +690,8 @@
   char      szodata[20],szidata[20]="MySQL";
   SQLSMALLINT pccol;
 
-    SQLFreeStmt(hstmt,SQL_CLOSE);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_prepare");
 
-    tmysql_exec(hstmt,"drop table t_prepare");
-
     rc = tmysql_exec(hstmt,"create table t_prepare(col1 int primary key, col2
varchar(30), col3 set(\"one\", \"two\"))");
     mystmt(hstmt,rc);
 
@@ -739,6 +743,8 @@
     rc = SQLFreeStmt(hstmt,SQL_RESET_PARAMS);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_prepare");
+
   return OK;
 }
 
@@ -748,7 +754,7 @@
   SQLRETURN rc;
   SQLINTEGER nidata= 1000;
 
-    tmysql_exec(hstmt,"drop table t_prepare1");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_prepare1");
 
     rc = tmysql_exec(hstmt,"create table t_prepare1(col1 int primary key, col2
varchar(30))");
     mystmt(hstmt,rc);
@@ -792,6 +798,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_prepare1");
+
   return OK;
 }
 
@@ -803,7 +811,7 @@
     SQLLEN     nlen;
     SQLCHAR   szodata[20],szidata[20]="MySQL";
 
-    tmysql_exec(hstmt,"drop table tmysql_bindcol");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS tmysql_bindcol");
 
     rc = tmysql_exec(hstmt,"create table tmysql_bindcol(col1 int primary key, col2
varchar(30))");
     mystmt(hstmt,rc);
@@ -859,12 +867,8 @@
     rc = SQLFreeStmt(hstmt,SQL_RESET_PARAMS);
     mystmt(hstmt,rc);
 
-    rc = tmysql_exec(hstmt,"drop table tmysql_bindcol");
-    mystmt(hstmt,rc);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS tmysql_bindcol");
 
-    rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
-    mycon(hdbc,rc);
-
   return OK;
 }
 
@@ -953,7 +957,8 @@
     SQLLEN pcrow;
     SQLHSTMT hstmt1;
 
-    tmysql_exec(hstmt,"drop table t_acc_update");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_acc_update");
+
     rc = tmysql_exec(hstmt,"create table t_acc_update(id int)");
     mystmt(hstmt,rc);
 
@@ -1023,6 +1028,8 @@
     rc = SQLSetConnectOption(hdbc,SQL_AUTOCOMMIT,1L);
     mycon(hdbc,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_acc_update");
+
   return OK;
 }
 

Modified: trunk/test/my_relative.c
===================================================================
--- trunk/test/my_relative.c	2007-08-27 16:38:56 UTC (rev 699)
+++ trunk/test/my_relative.c	2007-08-27 17:32:50 UTC (rev 700)
@@ -309,7 +309,7 @@
     ok_stmt(hstmt, SQLSetStmtAttr(hstmt, SQL_ATTR_CURSOR_TYPE,
                                   (SQLPOINTER)SQL_CURSOR_STATIC, 0));
 
-    SQLExecDirect(hstmt,"drop table t_relative2",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_relative2");
 
     rc = SQLExecDirect(hstmt,"create table t_relative2(id int)",SQL_NTS);
     mystmt(hstmt,rc);
@@ -541,6 +541,8 @@
     rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)1,0);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_relative2");
+
   return OK;
 }
 
@@ -551,7 +553,7 @@
     SQLULEN rowsFetched, rowsSize;
     long         i;
 
-    SQLExecDirect(hstmt,"drop table t_rows_fetched_ptr",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_rows_fetched_ptr");
 
     rc = SQLExecDirect(hstmt,"create table t_rows_fetched_ptr(a int)",SQL_NTS);
     mystmt(hstmt,rc);
@@ -673,6 +675,8 @@
     rc = SQLSetStmtAttr(hstmt, SQL_ATTR_ROWS_FETCHED_PTR, NULL, 0);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_rows_fetched_ptr");
+
   return OK;
 }
 
@@ -683,7 +687,7 @@
   SQLULEN     rowsFetched, rowsSize;
   SQLINTEGER  i;
 
-    SQLExecDirect(hstmt,"drop table t_rows_fetched_ptr",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_rows_fetched_ptr");
 
     rc = SQLExecDirect(hstmt,"create table t_rows_fetched_ptr(a int)",SQL_NTS);
     mystmt(hstmt,rc);
@@ -805,6 +809,8 @@
     rc = SQLSetStmtAttr(hstmt, SQL_ATTR_ROWS_FETCHED_PTR, NULL, 0);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_rows_fetched_ptr");
+
   return OK;
 }
 

Modified: trunk/test/my_result.c
===================================================================
--- trunk/test/my_result.c	2007-08-27 16:38:56 UTC (rev 699)
+++ trunk/test/my_result.c	2007-08-27 17:32:50 UTC (rev 700)
@@ -138,8 +138,6 @@
   SQLCHAR     DbVersion[MAX_NAME_LEN];
   SQLINTEGER  OdbcVersion;
 
-    SQLFreeStmt(hstmt, SQL_CLOSE);
-
     rc = SQLGetEnvAttr(henv,SQL_ATTR_ODBC_VERSION,&OdbcVersion,0,NULL);
     myenv(henv,rc);
 
@@ -158,7 +156,7 @@
     rc = SQLGetInfo(hdbc,SQL_DBMS_VER,(SQLCHAR *)&DbVersion,MAX_NAME_LEN,NULL);
     mycon(hdbc,rc);
 
-    SQLExecDirect(hstmt,"DROP TABLE t_convert",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_convert");
 
     rc = SQLExecDirect(hstmt,"CREATE TABLE t_convert(col0 integer, \
                                                      col1 date,\
@@ -245,11 +243,8 @@
       SQLFreeStmt(hstmt,SQL_CLOSE);
     }
 
-    rc = SQLExecDirect(hstmt,"DROP TABLE t_convert",SQL_NTS);
-    mystmt(hstmt,rc);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_convert");
 
-    SQLFreeStmt(hstmt,SQL_CLOSE);
-
   return OK;
 }
 
@@ -371,11 +366,8 @@
   SQLLEN     data_len;
   SQLCHAR    data[50];
 
-    tmysql_exec(hstmt,"drop table t_convert");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_convert");
 
-    rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
-    mycon(hdbc,rc);
-
     rc = tmysql_exec(hstmt,"CREATE TABLE t_convert(testing tinytext)");
     mystmt(hstmt,rc);
 
@@ -416,6 +408,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_convert");
+
   return OK;
 }
 
@@ -425,7 +419,7 @@
   SQLRETURN rc;
   SQLUINTEGER i;
 
-    tmysql_exec(hstmt,"drop table t_max_rows");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_max_rows");
 
     rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
     mycon(hdbc,rc);
@@ -505,6 +499,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_max_rows");
+
   return OK;
 }
 
@@ -516,7 +512,7 @@
   SQLLEN     pcbValue;
   SQLINTEGER id;
 
-    tmysql_exec(hstmt,"drop table t_multistep");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_multistep");
     rc = tmysql_exec(hstmt,"create table t_multistep(col1 int,col2 varchar(200))");
     mystmt(hstmt,rc);
 
@@ -610,6 +606,8 @@
     SQLFreeStmt(hstmt,SQL_UNBIND);
     SQLFreeStmt(hstmt,SQL_CLOSE);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_multistep");
+
   return OK;
 }
 
@@ -620,7 +618,7 @@
   SQLCHAR    szData[100], bData[100], bData1[100];
   SQLLEN     pcbValue,pcbValue1,pcbValue2;
 
-    tmysql_exec(hstmt,"drop table t_zerolength");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_zerolength");
     rc = tmysql_exec(hstmt,"create table t_zerolength(str varchar(20), bin varbinary(20),
blb blob)");
     mystmt(hstmt,rc);
 
@@ -795,6 +793,8 @@
     SQLFreeStmt(hstmt,SQL_UNBIND);
     SQLFreeStmt(hstmt,SQL_CLOSE);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_zerolength");
+
   return OK;
 }
 
@@ -988,7 +988,7 @@
   SQLLEN       name_len, desc_len;
   SQLCHAR      name[20], desc[20];
 
-    tmysql_exec(hstmt,"drop table t_empty_str_bug");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_empty_str_bug");
 
     rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
     mycon(hdbc,rc);
@@ -1065,6 +1065,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_empty_str_bug");
+
   return OK;
 }
 
@@ -1076,6 +1078,7 @@
     SQLSMALLINT collen,datatype,decptr,nullable;
     SQLULEN colsize;
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_desccol");
     tmysql_exec(hstmt,"drop table t_desccol");
 
     rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
@@ -1120,6 +1123,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_desccol");
+
   return OK;
 }
 
@@ -1168,7 +1173,7 @@
     SQLRETURN rc;
     SQLCHAR     *sql;
 
-    tmysql_exec(hstmt,"drop table t_desccolext");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_desccolext");
 
     rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
     mycon(hdbc,rc);
@@ -1273,6 +1278,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_desccolext");
+
   return OK;
 }
 
@@ -1281,7 +1288,7 @@
 {
     SQLRETURN rc;
 
-    tmysql_exec(hstmt,"drop table if exists t_desccol1");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_desccol1");
     rc = SQLExecDirect(hstmt,"create table t_desccol1\
                  ( record decimal(8,0),\
                    title varchar(250),\
@@ -1336,6 +1343,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_desccol1");
+
   return OK;
 }
 
@@ -1430,7 +1439,7 @@
     ok_stmt(hstmt, SQLSetStmtAttr(hstmt, SQL_ATTR_CURSOR_TYPE,
                                   (SQLPOINTER)SQL_CURSOR_STATIC, 0));
 
-    tmysql_exec(hstmt,"drop table t_exfetch");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_exfetch");
 
     rc = tmysql_exec(hstmt,"create table t_exfetch(col1 int)");
     mystmt(hstmt,rc);
@@ -1545,6 +1554,8 @@
     SQLFreeStmt(hstmt,SQL_UNBIND);
     SQLFreeStmt(hstmt,SQL_CLOSE);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_exfetch");
+
   return OK;
 }
 
@@ -1564,7 +1575,7 @@
     rc = SQLSetCursorName(hstmt,"venu_cur",SQL_NTS);
     mystmt(hstmt,rc);
 
-    tmysql_exec(hstmt,"drop table tmysql_rowstatus");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS tmysql_rowstatus");
     rc = tmysql_exec(hstmt,"create table tmysql_rowstatus(col1 int , col2 varchar(30))");
     mystmt(hstmt,rc);
 
@@ -1642,6 +1653,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS tmysql_rowstatus");
+
   return OK;
 }
 

Modified: trunk/test/my_scroll.c
===================================================================
--- trunk/test/my_scroll.c	2007-08-27 16:38:56 UTC (rev 699)
+++ trunk/test/my_scroll.c	2007-08-27 17:32:50 UTC (rev 700)
@@ -129,7 +129,7 @@
     ok_stmt(hstmt, SQLSetStmtAttr(hstmt, SQL_ATTR_CURSOR_TYPE,
                                   (SQLPOINTER)SQL_CURSOR_STATIC, 0));
 
-    SQLExecDirect(hstmt,"drop table t_array_relative_10",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_array_relative_10");
 
     rc = SQLExecDirect(hstmt,"create table t_array_relative_10(id int,name
char(20))",SQL_NTS);
     mystmt(hstmt,rc);
@@ -258,6 +258,8 @@
     rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)1,0);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_array_relative_10");
+
   return OK;
 }
 
@@ -273,7 +275,7 @@
     ok_stmt(hstmt, SQLSetStmtAttr(hstmt, SQL_ATTR_CURSOR_TYPE,
                                   (SQLPOINTER)SQL_CURSOR_STATIC, 0));
 
-    SQLExecDirect(hstmt,"drop table t_relative_1",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_relative_1");
 
     rc = SQLExecDirect(hstmt,"create table t_relative_1(id int)",SQL_NTS);
     mystmt(hstmt,rc);
@@ -467,6 +469,8 @@
     rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)1,0);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_relative_1");
+
   return OK;
 }
 
@@ -483,7 +487,7 @@
     ok_stmt(hstmt, SQLSetStmtAttr(hstmt, SQL_ATTR_CURSOR_TYPE,
                                   (SQLPOINTER)SQL_CURSOR_STATIC, 0));
 
-    SQLExecDirect(hstmt,"drop table t_array_relative_2",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_array_relative_2");
 
     rc = SQLExecDirect(hstmt,"create table t_array_relative_2(id int)",SQL_NTS);
     mystmt(hstmt,rc);
@@ -779,6 +783,8 @@
     rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)1,0);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_array_relative_2");
+
   return OK;
 }
 
@@ -794,7 +800,7 @@
     ok_stmt(hstmt, SQLSetStmtAttr(hstmt, SQL_ATTR_CURSOR_TYPE,
                                   (SQLPOINTER)SQL_CURSOR_STATIC, 0));
 
-    SQLExecDirect(hstmt,"drop table t_absolute_1",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_absolute_1");
 
     rc = SQLExecDirect(hstmt,"create table t_absolute_1(id int)",SQL_NTS);
     mystmt(hstmt,rc);
@@ -963,6 +969,8 @@
     rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)1,0);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_absolute_1");
+
   return OK;
 }
 
@@ -979,7 +987,7 @@
     ok_stmt(hstmt, SQLSetStmtAttr(hstmt, SQL_ATTR_CURSOR_TYPE,
                                   (SQLPOINTER)SQL_CURSOR_STATIC, 0));
 
-    SQLExecDirect(hstmt,"drop table t_absolute_2",SQL_NTS);
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_absolute_2");
 
     rc = SQLExecDirect(hstmt,"create table t_absolute_2(id int)",SQL_NTS);
     mystmt(hstmt,rc);
@@ -1218,6 +1226,8 @@
     rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)1,0);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_absolute_2");
+
   return OK;
 }
 
@@ -1225,8 +1235,8 @@
 BEGIN_TESTS
   ADD_TEST(t_scroll)
   ADD_TEST(t_array_relative_10)
+  ADD_TEST(t_array_relative_2)
   ADD_TEST(t_relative_1)
-  ADD_TEST(t_array_relative_2)
   ADD_TEST(t_absolute_1)
   ADD_TEST(t_absolute_2)
 END_TESTS

Modified: trunk/test/my_types.c
===================================================================
--- trunk/test/my_types.c	2007-08-27 16:38:56 UTC (rev 699)
+++ trunk/test/my_types.c	2007-08-27 17:32:50 UTC (rev 700)
@@ -133,7 +133,7 @@
   SQLINTEGER      i_data=189, l_data=-23;
   SQLRETURN       rc;
 
-    tmysql_exec(hstmt,"drop table t_decimal");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_decimal");
     rc = tmysql_exec(hstmt,"create table t_decimal(d1 decimal(10,6))");
     mystmt(hstmt,rc);
 
@@ -215,6 +215,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_decimal");
+
   return OK;
 }
 
@@ -347,7 +349,7 @@
     SQLCHAR szEnum[40]="MYSQL_E1";
     SQLCHAR szSet[40]="THREE,ONE,TWO";
 
-    tmysql_exec(hstmt,"drop table t_enumset");
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_enumset");
 
     rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
     mycon(hdbc,rc);
@@ -399,6 +401,8 @@
     rc = SQLFreeStmt(hstmt,SQL_CLOSE);
     mystmt(hstmt,rc);
 
+  ok_sql(hstmt, "DROP TABLE IF EXISTS t_enumset");
+
   return OK;
 }
 

Thread
Connector/ODBC 3.51 commit: r700 - trunk/testjwinstead27 Aug