Date: Friday, February 24, 2006 @ 16:27:57
Author: marc
Path: /cvsroot/carob/odbsequoia/src
Modified: simpletest.c (1.10 -> 1.11)
Added very primitive test for SQLBindCol() & SQLFetch()
--------------+
simpletest.c | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+)
Index: odbsequoia/src/simpletest.c
diff -u odbsequoia/src/simpletest.c:1.10 odbsequoia/src/simpletest.c:1.11
--- odbsequoia/src/simpletest.c:1.10 Thu Jan 19 17:39:36 2006
+++ odbsequoia/src/simpletest.c Fri Feb 24 16:27:57 2006
@@ -115,10 +115,42 @@
printf ("%ld rows were updated (through SQLRowCount) \n", uc);
+
+ /** Testing resultset */
+
+ SQLINTEGER intread;
+ SQLLEN ind;
+
+ EXEC_AND_DIAGS( // bind to col 1
+ SQLBindCol(hstmt, 1, SQL_C_SLONG, &intread, 0, &ind),
+ SQL_HANDLE_STMT, hstmt, 0);
+
+ EXEC_AND_DIAGS( // bind to col 3
+ SQLBindCol(hstmt, 3, SQL_C_SLONG, &intread, 0, &ind),
+ SQL_HANDLE_STMT, hstmt, 0);
+
+ EXEC_AND_DIAGS( // unbind from col 3
+ SQLBindCol(hstmt, 3, SQL_C_SLONG, 0 /* unbind */, 0, &ind),
+ SQL_HANDLE_STMT, hstmt, 0);
+
+ EXEC_AND_DIAGS(
+ SQLExecDirect(hstmt, (SQLCHAR *) "SELECT * FROM PRODUCT ", SQL_NTS),
+ SQL_HANDLE_STMT, hstmt, 0);
+
+ for (int i = 0; i < 6; i++)
+ {
+ EXEC_AND_DIAGS(
+ SQLFetch(hstmt),
+ SQL_HANDLE_STMT, hstmt, 0);
+ printf ("fetched ID: %ld \n", intread);
+ }
+
return 0;
}
+/** Utility function to query & print diagnostics after each call */
+
void print_diags(int pc, SQLSMALLINT hdletype, SQLHANDLE hdle)
{
SQLINTEGER irec, recmax;
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits