test/expected/alter.out \
test/expected/arraybinding.out \
test/expected/bindcol.out \
+ test/expected/bookmark.out \
test/expected/boolsaschar.out \
test/expected/catalogfunctions.out \
test/expected/commands.out \
test/expected/connect.out \
test/expected/cte.out \
test/expected/cursor-commit.out \
+ test/expected/cursor-movement.out \
test/expected/declare-fetch-commit-test.out \
test/expected/cursors.out \
test/expected/cursors_1.out \
test/expected/sampletables.out \
test/expected/select.out \
test/expected/stmthandles.out \
+ test/expected/update.out \
test/launcher \
test/Makefile.in \
test/odbc.ini \
test/src/alter-test.c \
test/src/arraybinding-test.c \
test/src/bindcol-test.c \
+ test/src/bookmark-test.c \
test/src/boolsaschar-test.c \
test/src/catalogfunctions-test.c \
test/src/commands-test.c \
test/src/connect-test.c \
test/src/cte-test.c \
test/src/cursor-commit-test.c \
+ test/src/cursor-movement-test.c \
test/src/declare-fetch-commit-test.c \
test/src/cursors-test.c \
test/src/cvtnulldate-test.c \
test/src/result-conversions-test.c \
test/src/select-test.c \
test/src/stmthandles-test.c \
+ test/src/update-test.c \
test/tests \
test/win.mak
--- /dev/null
+\! "./src/bookmark-test"
+connected
+Getting bookmark to beginning of result set...
+fetched: foo1
+Moving +100...
+fetched: foo101
+Getting bookmark to middle of result set...
+Moving +100...
+fetched: foo201
+Testing SQL_FETCH_BOOKMARK, begin (0)...
+fetched: foo1
+Testing SQL_FETCH_BOOKMARK, begin (10)...
+fetched: foo11
+Testing SQL_FETCH_BOOKMARK, middle (0)...
+fetched: foo101
+Testing SQL_FETCH_BOOKMARK, middle (10)...
+fetched: foo111
+Testing SQL_FETCH_BOOKMARK, middle (-10)...
+fetched: foo91
+disconnecting
\! "./src/connect-test"
connected
disconnecting
+Connecting with SQLConnect...connected
+disconnecting
--- /dev/null
+\! "./src/cursor-movement-test"
+connected
+SQL_CURSOR_COMMIT_BEHAVIOR: SQL_CB_PRESERVE
+SQL_CURSOR_ROLLBACK_BEHAVIOR: SQL_CB_PRESERVE
+
+fetched: foo1
+fetched: foo2
+fetched: foo3
+fetched: foo4
+fetched: foo5
+fetched: foo6
+fetched: foo7
+fetched: foo8
+fetched: foo9
+fetched: foo10
+Testing SQL_FETCH_NEXT...
+fetched: foo11
+fetched: foo12
+Testing SQL_FETCH_PRIOR...
+fetched: foo11
+Testing SQL_FETCH_ABSOLUTE (5)...
+fetched: foo5
+Testing SQL_FETCH_RELATIVE (+2)...
+fetched: foo7
+Testing SQL_FETCH_RELATIVE (-2)...
+fetched: foo5
+Testing SQL_FETCH_RELATIVE (+1)...
+fetched: foo6
+Testing SQL_FETCH_RELATIVE (0, no movement)...
+fetched: foo6
+Testing SQL_FETCH_FIRST...
+fetched: foo1
+Testing SQL_FETCH_PRIOR before first row...
+Fetch: no data found
+Fetch: no data found
+Testing SQL_FETCH_NEXT...
+fetched: foo1
+Testing SQL_FETCH_LAST...
+fetched: foo3210
+Testing SQL_FETCH_LAST...
+fetched: foo3210
+Testing SQL_FETCH_NEXT at the end of result set
+Fetch: no data found
+Testing SQL_FETCH_NEXT at the end of result set
+Fetch: no data found
+And SQL_FETCH_PRIOR...
+fetched: foo3210
+Testing SQL_FETCH_RELATIVE (+10)...
+Fetch: no data found
+And SQL_FETCH_PRIOR...
+fetched: foo3210
+Testing negative SQL_FETCH_ABSOLUTE (-5)...
+fetched: foo3206
+Testing negative SQL_FETCH_ABSOLUTE, before start...
+Fetch: no data found
+Testing SQL_FETCH_ABSOLUTE, beoynd end...
+Fetch: no data found
+disconnecting
--- /dev/null
+\! "./src/update-test"
+connected
+# of rows inserted: 1
+# of rows inserted: 1
+# of rows inserted: 1
+# of rows inserted: 1
+# of rows inserted: 1
+# of rows updated: 3
+# of rows deleted: 2
+Result set:
+5 foobar
+1 updated 1
+3 updated 3
+disconnecting
--- /dev/null
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "common.h"
+
+static void
+printFetchResult(HSTMT hstmt, int rc)
+{
+ if (SQL_SUCCEEDED(rc))
+ {
+ char buf[40];
+ SQLLEN ind;
+
+ if (rc == SQL_SUCCESS_WITH_INFO)
+ print_diag("got SUCCESS_WITH_INFO", SQL_HANDLE_STMT, hstmt);
+
+ rc = SQLGetData(hstmt, 1, SQL_C_CHAR, buf, sizeof(buf), &ind);
+ CHECK_STMT_RESULT(rc, "SQLGetData failed", hstmt);
+ printf("fetched: %s\n", buf);
+ }
+ else if (rc == SQL_NO_DATA)
+ printf("Fetch: no data found\n"); /* expected */
+ else
+ CHECK_STMT_RESULT(rc, "Fetch failed", hstmt);
+}
+
+static void
+testBookmarks(HSTMT hstmt)
+{
+ char book_before[100];
+ SQLLEN book_before_ind;
+ char book_middle[100];
+ SQLLEN book_middle_ind;
+ int rc;
+
+ /* Make the cursor scrollable */
+ rc = SQLSetStmtAttr(hstmt, SQL_CURSOR_TYPE,
+ (SQLPOINTER) SQL_CURSOR_STATIC, SQL_IS_UINTEGER);
+ CHECK_STMT_RESULT(rc, "SQLSetStmtAttr failed", hstmt);
+
+ /* Enable bookmarks */
+ rc = SQLSetStmtAttr(hstmt, SQL_ATTR_USE_BOOKMARKS,
+ (SQLPOINTER) SQL_UB_VARIABLE, SQL_IS_UINTEGER);
+ CHECK_STMT_RESULT(rc, "SQLSetStmtAttr failed", hstmt);
+
+ /*
+ * Fetch a large result set.
+ */
+ rc = SQLExecDirect(hstmt, (SQLCHAR *) "SELECT 'foo' || g FROM generate_series(1, 3210) g", SQL_NTS);
+ CHECK_STMT_RESULT(rc, "SQLExecDirect failed", hstmt);
+
+ /* Get a bookmark that points to the beginning of the result set */
+ printf("Getting bookmark to beginning of result set...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_NEXT, 0);
+ printFetchResult(hstmt, rc);
+
+ rc = SQLGetData(hstmt, 0, SQL_C_VARBOOKMARK, book_before, sizeof(book_before), &book_before_ind);
+ CHECK_STMT_RESULT(rc, "SQLGetData failed", hstmt);
+
+ printf("Moving +100...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_RELATIVE, 100);
+ printFetchResult(hstmt, rc);
+
+ /* Get a bookmark that points to the middle of the result set */
+ printf("Getting bookmark to middle of result set...\n");
+ rc = SQLGetData(hstmt, 0, SQL_C_VARBOOKMARK, book_middle, sizeof(book_middle), &book_middle_ind);
+ CHECK_STMT_RESULT(rc, "SQLGetData failed", hstmt);
+
+ /*** Ok, test SQLFetchScroll with the bookmark ***/
+
+ printf("Moving +100...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_RELATIVE, 100);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing SQL_FETCH_BOOKMARK, begin (0)...\n");
+ rc = SQLSetStmtAttr(hstmt, SQL_ATTR_FETCH_BOOKMARK_PTR,
+ (SQLPOINTER) book_before, SQL_IS_POINTER);
+ CHECK_STMT_RESULT(rc, "SQLSetStmtAttr failed", hstmt);
+
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_BOOKMARK, 0);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing SQL_FETCH_BOOKMARK, begin (10)...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_BOOKMARK, 10);
+ printFetchResult(hstmt, rc);
+
+ /*** Test SQLFetchScroll with the middle bookmark ***/
+
+ printf("Testing SQL_FETCH_BOOKMARK, middle (0)...\n");
+ rc = SQLSetStmtAttr(hstmt, SQL_ATTR_FETCH_BOOKMARK_PTR,
+ (SQLPOINTER) book_middle, SQL_IS_POINTER);
+ CHECK_STMT_RESULT(rc, "SQLSetStmtAttr failed", hstmt);
+
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_BOOKMARK, 0);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing SQL_FETCH_BOOKMARK, middle (10)...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_BOOKMARK, 10);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing SQL_FETCH_BOOKMARK, middle (-10)...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_BOOKMARK, -10);
+ printFetchResult(hstmt, rc);
+
+ rc = SQLFreeStmt(hstmt, SQL_CLOSE);
+ CHECK_STMT_RESULT(rc, "SQLFreeStmt failed", hstmt);
+}
+
+int main(int argc, char **argv)
+{
+ int rc;
+ HSTMT hstmt = SQL_NULL_HSTMT;
+ SQLUSMALLINT info;
+
+ test_connect();
+
+ rc = SQLAllocHandle(SQL_HANDLE_STMT, conn, &hstmt);
+ if (!SQL_SUCCEEDED(rc))
+ {
+ print_diag("failed to allocate stmt handle", SQL_HANDLE_DBC, conn);
+ exit(1);
+ }
+
+ testBookmarks(hstmt);
+
+ /* Clean up */
+ test_disconnect();
+
+ return 0;
+}
message, 256, &textlen);
if (ret == SQL_INVALID_HANDLE)
printf("Invalid handle\n");
+ if (ret == SQL_NO_DATA)
+ printf("No error information\n");
else if (ret != SQL_ERROR)
printf("%s=%s\n", (CHAR *)sqlstate, (CHAR *)message);
}
#include "common.h"
+static void
+test_SQLConnect()
+{
+ SQLRETURN ret;
+ SQLCHAR *dsn = (SQLCHAR *) "psqlodbc_test_dsn";
+
+ SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
+
+ SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0);
+
+ SQLAllocHandle(SQL_HANDLE_DBC, env, &conn);
+
+ printf("Connecting with SQLConnect...");
+
+ ret = SQLConnect(conn, dsn, SQL_NTS, NULL, 0, NULL, 0);
+ if (SQL_SUCCEEDED(ret)) {
+ printf("connected\n");
+ } else {
+ print_diag("SQLDriverConnect failed.", SQL_HANDLE_DBC, conn);
+ exit(1);
+ }
+}
+
int main(int argc, char **argv)
{
+ /* the common test_connect() function uses SQLDriverConnect */
test_connect();
test_disconnect();
+ test_SQLConnect();
+ test_disconnect();
+
return 0;
}
--- /dev/null
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "common.h"
+
+static void
+printFetchResult(HSTMT hstmt, int rc)
+{
+ if (SQL_SUCCEEDED(rc))
+ {
+ char buf[40];
+ SQLLEN ind;
+
+ if (rc == SQL_SUCCESS_WITH_INFO)
+ print_diag("got SUCCESS_WITH_INFO", SQL_HANDLE_STMT, hstmt);
+
+ rc = SQLGetData(hstmt, 1, SQL_C_CHAR, buf, sizeof(buf), &ind);
+ CHECK_STMT_RESULT(rc, "SQLGetData failed", hstmt);
+ printf("fetched: %s\n", buf);
+ }
+ else if (rc == SQL_NO_DATA)
+ printf("Fetch: no data found\n"); /* expected */
+ else
+ CHECK_STMT_RESULT(rc, "Fetch failed", hstmt);
+}
+
+static void
+testLargeResult(HSTMT hstmt)
+{
+ int rc;
+ int i;
+
+ /* Make the cursor scrollable */
+ rc = SQLSetStmtAttr(hstmt, SQL_CURSOR_TYPE,
+ (SQLPOINTER) SQL_CURSOR_STATIC, SQL_IS_UINTEGER);
+ CHECK_STMT_RESULT(rc, "SQLSetStmtAttr failed", hstmt);
+
+ /*
+ * Fetch a large result set without cursor (in Declare/fetch mode, it will
+ * be fetched in chunks)
+ */
+ rc = SQLExecDirect(hstmt, (SQLCHAR *) "SELECT 'foo' || g FROM generate_series(1, 3210) g", SQL_NTS);
+ CHECK_STMT_RESULT(rc, "SQLExecDirect failed", hstmt);
+
+ /* Fetch the first 10 rows */
+ for (i = 0; i < 10; i++)
+ {
+ rc = SQLFetch(hstmt);
+ printFetchResult(hstmt, rc);
+ }
+
+ /* Test all the SQL_FETCH_* modes with SQLFetchScroll */
+ printf("Testing SQL_FETCH_NEXT...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_NEXT, 0);
+ printFetchResult(hstmt, rc);
+
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_NEXT, 0);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing SQL_FETCH_PRIOR...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_PRIOR, 0);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing SQL_FETCH_ABSOLUTE (5)...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_ABSOLUTE, 5);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing SQL_FETCH_RELATIVE (+2)...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_RELATIVE, 2);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing SQL_FETCH_RELATIVE (-2)...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_RELATIVE, -2);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing SQL_FETCH_RELATIVE (+1)...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_RELATIVE, 1);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing SQL_FETCH_RELATIVE (0, no movement)...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_RELATIVE, 0);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing SQL_FETCH_FIRST...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_FIRST, 0);
+ printFetchResult(hstmt, rc);
+
+ /*** Ok, now test the behavior at "before first row" ***/
+ printf("Testing SQL_FETCH_PRIOR before first row...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_PRIOR, 0);
+ printFetchResult(hstmt, rc);
+
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_PRIOR, 0);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing SQL_FETCH_NEXT...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_NEXT, 0);
+ printFetchResult(hstmt, rc);
+
+ /*** Test behavior at the end ***/
+
+ printf("Testing SQL_FETCH_LAST...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_LAST, 0);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing SQL_FETCH_LAST...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_LAST, 0);
+ printFetchResult(hstmt, rc);
+
+
+ printf("Testing SQL_FETCH_NEXT at the end of result set\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_NEXT, 0);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing SQL_FETCH_NEXT at the end of result set\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_NEXT, 0);
+ printFetchResult(hstmt, rc);
+
+ printf("And SQL_FETCH_PRIOR...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_PRIOR, 0);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing SQL_FETCH_RELATIVE (+10)...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_RELATIVE, 10);
+ printFetchResult(hstmt, rc);
+
+ printf("And SQL_FETCH_PRIOR...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_PRIOR, 0);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing negative SQL_FETCH_ABSOLUTE (-5)...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_ABSOLUTE, -5);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing negative SQL_FETCH_ABSOLUTE, before start...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_ABSOLUTE, -10000);
+ printFetchResult(hstmt, rc);
+
+ printf("Testing SQL_FETCH_ABSOLUTE, beoynd end...\n");
+ rc = SQLFetchScroll(hstmt, SQL_FETCH_ABSOLUTE, 10000);
+ printFetchResult(hstmt, rc);
+
+ rc = SQLFreeStmt(hstmt, SQL_CLOSE);
+ CHECK_STMT_RESULT(rc, "SQLFreeStmt failed", hstmt);
+}
+
+static const char *
+sql_commit_behavior_str(SQLUINTEGER info)
+{
+ static char buf[50];
+
+ switch(info)
+ {
+ case SQL_CB_DELETE:
+ return "SQL_CB_DELETE";
+
+ case SQL_CB_CLOSE:
+ return "SQL_CB_CLOSE";
+
+ case SQL_CB_PRESERVE:
+ return "SQL_CB_PRESERVE";
+
+ default:
+ sprintf(buf, "unknown (%u)", (unsigned int) info);
+ return buf;
+ }
+}
+
+int main(int argc, char **argv)
+{
+ int rc;
+ HSTMT hstmt = SQL_NULL_HSTMT;
+ SQLUSMALLINT info;
+
+ test_connect();
+
+ rc = SQLAllocHandle(SQL_HANDLE_STMT, conn, &hstmt);
+ if (!SQL_SUCCEEDED(rc))
+ {
+ print_diag("failed to allocate stmt handle", SQL_HANDLE_DBC, conn);
+ exit(1);
+ }
+
+ /*
+ * Print out the current SQL_CURSOR_COMMIT_BEHAVIOR and
+ * SQL_CURSOR_ROLLBACK settings. The result of this test case depends on
+ * those.
+ */
+ rc = SQLGetInfo(conn, SQL_CURSOR_COMMIT_BEHAVIOR, &info, sizeof(info), NULL);
+ CHECK_STMT_RESULT(rc, "SQLGetInfo failed", hstmt);
+ printf("SQL_CURSOR_COMMIT_BEHAVIOR: %s\n", sql_commit_behavior_str(info));
+
+ rc = SQLGetInfo(conn, SQL_CURSOR_ROLLBACK_BEHAVIOR, &info, sizeof(info), NULL);
+ CHECK_STMT_RESULT(rc, "SQLGetInfo failed", hstmt);
+ printf("SQL_CURSOR_ROLLBACK_BEHAVIOR: %s\n\n", sql_commit_behavior_str(info));
+
+ /* Run the test */
+ testLargeResult(hstmt);
+
+ /* Clean up */
+ test_disconnect();
+
+ return 0;
+}
#include "common.h"
-void testLargeResult(HSTMT hstmt, int betweenstmts)
+static void
+testLargeResult(HSTMT hstmt, int betweenstmts)
{
int rc;
int i;
--- /dev/null
+/*
+ * Test DML (INSERT, UPDATE, DELETE) commands
+ */
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "common.h"
+
+int main(int argc, char **argv)
+{
+ SQLRETURN rc;
+ HSTMT hstmt = SQL_NULL_HSTMT;
+ char param1[100];
+ SQLLEN cbParam1;
+ SQLCHAR *sql;
+ int i;
+ SQLLEN rowcount;
+
+ test_connect();
+
+ rc = SQLAllocHandle(SQL_HANDLE_STMT, conn, &hstmt);
+ if (!SQL_SUCCEEDED(rc))
+ {
+ print_diag("failed to allocate stmt handle", SQL_HANDLE_DBC, conn);
+ exit(1);
+ }
+
+ /* Prepare a test table */
+ sql = "CREATE TEMPORARY TABLE tmptable (i int4, t text)";
+ rc = SQLExecDirect(hstmt, (SQLCHAR *) sql, SQL_NTS);
+ CHECK_STMT_RESULT(rc, "SQLExecDirect failed while creating temp table", hstmt);
+
+ /* Insert some rows, using a prepared statement */
+ rc = SQLPrepare(hstmt, (SQLCHAR *) "INSERT INTO tmptable VALUES (?, 'foobar')", SQL_NTS);
+ CHECK_STMT_RESULT(rc, "SQLPrepare failed", hstmt);
+ for (i = 1; i <= 5; i++)
+ {
+ /* bind params */
+ snprintf(param1, sizeof(param1), "%d", i);
+ cbParam1 = SQL_NTS;
+ rc = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT,
+ SQL_C_CHAR, /* value type */
+ SQL_CHAR, /* param type */
+ 20, /* column size */
+ 0, /* dec digits */
+ param1, /* param value ptr */
+ 0, /* buffer len */
+ &cbParam1 /* StrLen_or_IndPtr */);
+ CHECK_STMT_RESULT(rc, "SQLBindParameter failed", hstmt);
+
+ /* Execute */
+ rc = SQLExecute(hstmt);
+ CHECK_STMT_RESULT(rc, "SQLExecute failed", hstmt);
+
+ /* Test SQLRowCount() */
+ rc = SQLRowCount(hstmt, &rowcount);
+ CHECK_STMT_RESULT(rc, "SQLRowCount failed", hstmt);
+
+ printf("# of rows inserted: %d\n", (int) rowcount);
+
+ rc = SQLFreeStmt(hstmt, SQL_CLOSE);
+ CHECK_STMT_RESULT(rc, "SQLFreeStmt failed", hstmt);
+ }
+
+ /* Update some rows */
+ rc = SQLExecDirect(hstmt, (SQLCHAR *) "UPDATE tmptable SET t = 'updated ' || i WHERE i <= 3" , SQL_NTS);
+ CHECK_STMT_RESULT(rc, "SQLExecDirect failed", hstmt);
+
+ rc = SQLRowCount(hstmt, &rowcount);
+ CHECK_STMT_RESULT(rc, "SQLRowCount failed", hstmt);
+ printf("# of rows updated: %d\n", (int) rowcount);
+
+ rc = SQLFreeStmt(hstmt, SQL_CLOSE);
+ CHECK_STMT_RESULT(rc, "SQLFreeStmt failed", hstmt);
+
+ /* and delete some rows */
+ rc = SQLExecDirect(hstmt, (SQLCHAR *) "DELETE FROM tmptable WHERE i = 4 OR i = 2" , SQL_NTS);
+ CHECK_STMT_RESULT(rc, "SQLExecDirect failed", hstmt);
+
+ rc = SQLRowCount(hstmt, &rowcount);
+ CHECK_STMT_RESULT(rc, "SQLRowCount failed", hstmt);
+ printf("# of rows deleted: %d\n", (int) rowcount);
+
+ rc = SQLFreeStmt(hstmt, SQL_CLOSE);
+ CHECK_STMT_RESULT(rc, "SQLFreeStmt failed", hstmt);
+
+ /* Print the contents of the table after all the updates to verify */
+
+ rc = SQLExecDirect(hstmt, (SQLCHAR *) "SELECT * FROM tmptable", SQL_NTS);
+ CHECK_STMT_RESULT(rc, "SQLExecDirect failed", hstmt);
+ print_result(hstmt);
+
+ /* Clean up */
+ test_disconnect();
+
+ return 0;
+}
TESTBINS = src/connect-test \
src/stmthandles-test \
src/select-test \
+ src/update-test \
src/commands-test \
src/multistmt-test \
src/getresult-test \
src/alter-test \
src/quotes-test \
src/cursors-test \
+ src/cursor-movement-test \
src/cursor-commit-test \
+ src/bookmark-test \
src/declare-fetch-commit-test \
src/positioned-update-test \
src/catalogfunctions-test \