Modified:
trunk/ChangeLog
trunk/driver/results.c
trunk/test/my_error.c
Log:
Correctly return error if SQLBindCol is called with an invalid column
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-06-25 23:32:00 UTC (rev 536)
+++ trunk/ChangeLog 2007-06-26 18:27:39 UTC (rev 537)
@@ -21,6 +21,7 @@
and SQL_DESC_BASE_TABLE_NAME for aliased fields. (Bug #6197)
* Calling SQLGetDiagField with RecNumber 0,DiagIdentifier
NOT 0 returns SQL_ERROR (Bug #16224)
+ * Correctly return error if SQLBindCol is called with an invalid column
----
Modified: trunk/driver/results.c
===================================================================
--- trunk/driver/results.c 2007-06-25 23:32:00 UTC (rev 536)
+++ trunk/driver/results.c 2007-06-26 18:27:39 UTC (rev 537)
@@ -1010,7 +1010,7 @@
if ( !stmt->result || (uint) icol >= stmt->result->field_count )
{
- set_error(stmt,MYERR_S1002,"Invalid column number",0);
+ error= set_error(stmt,MYERR_S1002,"Invalid column number",0);
MYODBCDbgReturnReturn(error);
}
if ( !stmt->bind )
Modified: trunk/test/my_error.c
===================================================================
--- trunk/test/my_error.c 2007-06-25 23:32:00 UTC (rev 536)
+++ trunk/test/my_error.c 2007-06-26 18:27:39 UTC (rev 537)
@@ -288,6 +288,25 @@
}
+/*
+ * Test that binding invalid column returns the appropriate error
+ */
+DECLARE_TEST(bind_invalidcol)
+{
+ ok_sql(hstmt, "select 1,2,3,4");
+
+ /* test out of range column number */
+ expect_stmt(hstmt, SQLBindCol(hstmt, 10, SQL_C_CHAR, "", 4, NULL), SQL_ERROR);
+ is(check_sqlstate(hdbc, hstmt, "HY002") == OK);
+
+ /* test (unsupported) bookmark column number */
+ expect_stmt(hstmt, SQLBindCol(hstmt, 0, SQL_C_CHAR, "", 4, NULL), SQL_ERROR);
+ is(check_sqlstate(hdbc, hstmt, "HY002") == OK);
+
+ return OK;
+}
+
+
BEGIN_TESTS
#ifndef NO_DRIVERMANAGER
ADD_TEST(t_odbc2_error)
@@ -299,6 +318,7 @@
ADD_TEST(t_warning)
ADD_TODO(t_bug3456)
ADD_TEST(t_bug16224)
+ ADD_TEST(bind_invalidcol)
END_TESTS
RUN_TESTS
| Thread |
|---|
| • Connector/ODBC 3.51 commit: r537 - in trunk: . driver test | jbalint | 26 Jun |