Modified:
trunk/testsuites/t_jbalint/bind.c
trunk/testsuites/t_jbalint/getdata.c
trunk/testsuites/t_jbalint/unicode.c
Log:
corrected fixed-length binary test (uncovered w/odbc5 conversion code updates)
fixed up some unicode tests
Modified: trunk/testsuites/t_jbalint/bind.c
===================================================================
--- trunk/testsuites/t_jbalint/bind.c 2007-03-15 12:14:25 UTC (rev 41)
+++ trunk/testsuites/t_jbalint/bind.c 2007-03-19 18:14:22 UTC (rev 42)
@@ -256,7 +256,7 @@
(1 << 23) * -1, 99999,
/* int */
INT_MIN, UINT_MAX
- };
+ };
test_printf("basic\n");
bindparameter_int_group(tc, basic);
Modified: trunk/testsuites/t_jbalint/getdata.c
===================================================================
--- trunk/testsuites/t_jbalint/getdata.c 2007-03-15 12:14:25 UTC (rev 41)
+++ trunk/testsuites/t_jbalint/getdata.c 2007-03-19 18:14:22 UTC (rev 42)
@@ -130,8 +130,9 @@
CuAssertStrEquals(tc, "vcvc", xvarchar);
CuAssertIntEquals(tc, (int)strlen(xvarchar), len[21]);
CHECK_SQL_S(SQLGetData(stmt, 23, SQL_C_CHAR, &xbinary, STRLEN, &len[22]),
stmt);
- CuAssertStrEquals(tc, "bbb", xbinary);
- CuAssertIntEquals(tc, (int)strlen(xbinary), len[22]);
+ /*CuAssertStrEquals(tc, "bbb\0\0\0\0\0\0\0", xbinary);*/
+ CuAssert(tc, "", !memcmp("bbb\0\0\0\0\0\0\0", xbinary, 10));
+ CuAssertIntEquals(tc, 10, len[22]); /* fixed len binary */
CHECK_SQL_S(SQLGetData(stmt, 24, SQL_C_CHAR, &xvarbinary, STRLEN, &len[23]),
stmt);
CuAssertStrEquals(tc, "vbvb", xvarbinary);
CuAssertIntEquals(tc, (int)strlen(xvarbinary), len[23]);
@@ -298,6 +299,7 @@
}
/* test when date/time data is zero */
+/* TODO add non-zero test for bad time */
OT_TEST_METHOD(getdata_zero_datetime)
{
SQLHANDLE stmt = get_statement();
Modified: trunk/testsuites/t_jbalint/unicode.c
===================================================================
--- trunk/testsuites/t_jbalint/unicode.c 2007-03-15 12:14:25 UTC (rev 41)
+++ trunk/testsuites/t_jbalint/unicode.c 2007-03-19 18:14:22 UTC (rev 42)
@@ -23,7 +23,8 @@
CHECK_SQL_S(SQLFetch(stmt), stmt);
CuAssertIntEquals_Msg(tc, "Wide-string data",
- 0, memcmp(udata, TD_UNICODE_ID1STR, sizeof(TD_UNICODE_ID1STR)));
+ 0, memcmp(udata, TD_UNICODE_ID1STR,
+ wcslen(TD_UNICODE_ID1STR) * sizeof(SQLWCHAR)));
CuAssertIntEquals_Msg(tc, "Wide-string length",
(int)wcslen(TD_UNICODE_ID1STR) * sizeof(SQLWCHAR), ind);
@@ -38,14 +39,20 @@
SQLHANDLE stmt = get_statement();
SQLINTEGER rows;
SQLWCHAR *odata = L"משڮ۩∂";
+ SQLINTEGER olen;
+ SQLINTEGER tlen;
+ TC_SET_TXMODE(get_dbc_handle(), SQL_AUTOCOMMIT_OFF);
+
+ olen = wcslen(odata) * sizeof(wchar_t);
+ tlen = wcslen(TD_UNICODE_ID1STR) * sizeof(wchar_t);
+
/* first update the row to the new value */
CHECK_SQL_S(SQLBindParameter(stmt, 1, SQL_PARAM_INPUT,
- SQL_C_WCHAR, SQL_VARCHAR, STRLEN, 0,
- odata, sizeof(odata), NULL), stmt);
+ SQL_C_WCHAR, SQL_VARCHAR, STRLEN, 0, odata, 0, &olen), stmt);
CHECK_SQL_S(SQLBindParameter(stmt, 2, SQL_PARAM_INPUT,
SQL_C_WCHAR, SQL_VARCHAR, STRLEN, 0, (SQLPOINTER)TD_UNICODE_ID1STR,
- sizeof(TD_UNICODE_ID1STR), NULL), stmt);
+ 0, &tlen), stmt);
CHECK_SQL_S(SQLExecDirect(stmt, "update unicode set sample_data = ? "
"where sample_data = ?", SQL_NTS), stmt);
@@ -56,10 +63,9 @@
/* second update to set it back to the old value */
CHECK_SQL_S(SQLBindParameter(stmt, 1, SQL_PARAM_INPUT,
SQL_C_WCHAR, SQL_VARCHAR, STRLEN, 0, (SQLPOINTER)TD_UNICODE_ID1STR,
- sizeof(TD_UNICODE_ID1STR), NULL), stmt);
+ 0, &tlen), stmt);
CHECK_SQL_S(SQLBindParameter(stmt, 2, SQL_PARAM_INPUT,
- SQL_C_WCHAR, SQL_VARCHAR, STRLEN, 0,
- odata, sizeof(odata), NULL), stmt);
+ SQL_C_WCHAR, SQL_VARCHAR, STRLEN, 0, odata, 0, &olen), stmt);
CHECK_SQL_S(SQLExecDirect(stmt, "update unicode set sample_data = ? "
"where sample_data = ?", SQL_NTS), stmt);
@@ -67,6 +73,9 @@
CHECK_SQL_S(SQLRowCount(stmt, &rows), stmt);
CuAssertIntEquals_Msg(tc, "Second update worked", 1, rows);
+ TC_FINISH_TX(get_dbc_handle(), SQL_ROLLBACK);
+ TC_SET_TXMODE(get_dbc_handle(), SQL_AUTOCOMMIT_ON);
+
free_statement(stmt);
}
| Thread |
|---|
| • ODBC C-tests commit: r42 - trunk/testsuites/t_jbalint | jbalint | 19 Mar |