List:Commits« Previous MessageNext Message »
From:sebrecht Date:June 13 2007 1:53pm
Subject:ODBC C-tests commit: r142 - in trunk/testsuites: . t_bug_procedure
View as plain text  
Added:
   trunk/testsuites/t_bug_procedure/
   trunk/testsuites/t_bug_procedure/bug16817.c
   trunk/testsuites/t_bug_procedure/createprocedure.c
   trunk/testsuites/t_bug_procedure/dropprocedure.c
   trunk/testsuites/t_bug_procedure/t_bug_procedure.h
   trunk/testsuites/t_bug_procedure/t_bug_procedure_suite.c
Log:
testsuite for testing procedure behaviour
add tests for bug 16817


Added: trunk/testsuites/t_bug_procedure/bug16817.c
===================================================================
--- trunk/testsuites/t_bug_procedure/bug16817.c	2007-06-13 13:52:33 UTC (rev 141)
+++ trunk/testsuites/t_bug_procedure/bug16817.c	2007-06-13 13:53:55 UTC (rev 142)
@@ -0,0 +1,43 @@
+/* ******************************************
+ * This test is to look for the
+ * functionality of bug 16817
+ * created: 06/13/2007 susanne
+
+ ****************************************** */
+
+
+#include "t_bug_procedure.h"
+
+/* ******************************************
+   * the bug is, that the result set isn't
+   * ok.
+   * This test is skipped until SQLNextResult
+   * is implemented
+   
+   ****************************************** */
+
+OT_TEST_METHOD(bug16817)
+{
+  SQLCHAR rslt[2][STRLEN];
+  SQLRETURN rc;
+  int i= 0;
+  int j=0;
+  SQLHANDLE stmt= get_statement();
+  
+  SQLINTEGER *len= (SQLINTEGER *)malloc(sizeof(SQLINTEGER));
+
+  char *qry= "call bug16817(42)";
+  
+  OT_TODO("SQLNextReult has to implement and after this the test should work");
+
+  CHECK_SQL_S(SQLExecDirect(stmt, (SQLCHAR *)qry, SQL_NTS), stmt);
+  for (i= 0; (rc= SQLFetch(stmt)) == SQL_SUCCESS; ++i)
+  {
+    CHECK_SQL_S(SQLGetData(stmt, 1, SQL_C_CHAR,
+			   rslt[i], STRLEN, &len[i]), stmt);
+    test_printf("result: %s\n",rslt[i]);
+  }
+  test_printf("number of rows: %d\n",i);
+  free_statement(stmt);
+  if (i<2) OT_FAIL("the bug is not fixed ...");
+}

Added: trunk/testsuites/t_bug_procedure/createprocedure.c
===================================================================
--- trunk/testsuites/t_bug_procedure/createprocedure.c	2007-06-13 13:52:33 UTC (rev 141)
+++ trunk/testsuites/t_bug_procedure/createprocedure.c	2007-06-13 13:53:55 UTC (rev 142)
@@ -0,0 +1,34 @@
+/* ******************************************
+ * This test creates a procedure to test
+ * the functionality of bug 16817
+ * created: 06/13/2007 susanne
+
+ ****************************************** */
+
+
+#include "t_bug_procedure.h"
+
+/* ******************************************
+   * creates a simple procedure
+   * If the procedure already exists, it will
+   * drop it first
+   
+   ****************************************** */
+
+OT_TEST_METHOD(createprocedure)
+{
+  SQLHANDLE stmt= get_statement();
+  char *qry1= "drop procedure if exists bug16817";
+  char *qry2= "create procedure bug16817(id integer) "
+    "begin "
+    "select 'aaa'\; "
+    "select 'bbb'\; "
+    "end";
+  
+  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("procedure bug16817(integer) is created\n");
+}

Added: trunk/testsuites/t_bug_procedure/dropprocedure.c
===================================================================
--- trunk/testsuites/t_bug_procedure/dropprocedure.c	2007-06-13 13:52:33 UTC (rev 141)
+++ trunk/testsuites/t_bug_procedure/dropprocedure.c	2007-06-13 13:53:55 UTC (rev 142)
@@ -0,0 +1,21 @@
+/* ******************************************
+ * This test drops the procedure, that is
+ * need for testing bug 16817
+ * Is skipped because it doesn't work at
+ * the moment
+ * created: 06/13/2007 susanne
+
+ ****************************************** */
+
+
+#include "t_bug_procedure.h"
+
+OT_TEST_METHOD(dropprocedure)
+{
+  SQLHANDLE stmt= get_statement();
+  char *qry= "drop procedure if exists bug16817";
+  OT_SKIP("this test doesn't work at the moment, it seems if this is a follow of the
bug");
+  CHECK_SQL_S(SQLExecDirect(stmt, (SQLCHAR *)qry, SQL_NTS), stmt);
+  test_printf("procedure bug16817(integer) didn't exist anymore\n");
+  free_statement(stmt);
+}

Added: trunk/testsuites/t_bug_procedure/t_bug_procedure.h
===================================================================
--- trunk/testsuites/t_bug_procedure/t_bug_procedure.h	2007-06-13 13:52:33 UTC (rev 141)
+++ trunk/testsuites/t_bug_procedure/t_bug_procedure.h	2007-06-13 13:53:55 UTC (rev 142)
@@ -0,0 +1,11 @@
+#include "odbctest.h"
+
+/* test data definitions */
+extern const char *TD_DBNAME;
+
+extern const int TD_ALLTYPES_COLS;
+
+/* create tests */
+OT_TEST_METHOD(createprocedure);
+OT_TEST_METHOD(bug16817);
+OT_TEST_METHOD(dropprocedure);

Added: trunk/testsuites/t_bug_procedure/t_bug_procedure_suite.c
===================================================================
--- trunk/testsuites/t_bug_procedure/t_bug_procedure_suite.c	2007-06-13 13:52:33 UTC (rev
141)
+++ trunk/testsuites/t_bug_procedure/t_bug_procedure_suite.c	2007-06-13 13:53:55 UTC (rev
142)
@@ -0,0 +1,23 @@
+#include "t_bug_procedure.h"
+
+OT_SUITE_SETUP(bug_procedure_suite_setup)
+{  
+  if (!global_connect())
+    return "Cannot create global connection!";
+  else
+    return NULL;
+}
+
+OT_SUITE_TEARDOWN(bug_procedure_suite_teardown)
+{
+  global_disconnect();
+  return NULL;
+}
+
+OT_SUITE_REGISTER_START("bug_procedure",bug_procedure_suite_setup,bug_procedure_suite_teardown)
+/* create tests */
+     OT_SUITE_ADD_TEST(createprocedure, NULL, NULL);
+OT_SUITE_ADD_TEST(bug16817, NULL, NULL);
+OT_SUITE_ADD_TEST(dropprocedure, NULL, NULL);
+OT_SUITE_REGISTER_END
+

Thread
ODBC C-tests commit: r142 - in trunk/testsuites: . t_bug_proceduresebrecht13 Jun