Added:
trunk/testsuites/t_unixodbc_sap/sap_todo_v3.c
trunk/testsuites/t_unixodbc_sap/sap_todo_v3_v5.c
trunk/testsuites/t_unixodbc_sap/sap_todo_v5.c
Removed:
trunk/testsuites/t_unixodbc_sap/sap_todo.c
Modified:
trunk/testsuites/t_unixodbc_sap/sap_colall.c
trunk/testsuites/t_unixodbc_sap/sap_colattrb.c
trunk/testsuites/t_unixodbc_sap/t_unixodbc_sap_suite.c
trunk/testsuites/t_unixodbc_sap/t_unixodbc_sap_suite.h
Log:
Splitting up the TODO's into driver version specific files.
Modified: trunk/testsuites/t_unixodbc_sap/sap_colall.c
===================================================================
--- trunk/testsuites/t_unixodbc_sap/sap_colall.c 2007-06-07 07:04:39 UTC (rev 130)
+++ trunk/testsuites/t_unixodbc_sap/sap_colall.c 2007-06-07 09:20:40 UTC (rev 131)
@@ -465,6 +465,7 @@
int num_cols = 0;
OT_TODO("A developer and ODBC standard expert needs to check the TODO notes");
+ OT_TODO("Not all v5 problems are marked and/or isolated, bind seems broken");
OT_TODO("Complete but check sap_todo.c - todo1 to todo6 for isolated issues/possible
bugs");
OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
@@ -614,7 +615,6 @@
if (exp->decimal_digits_len != SQL_NULL_DATA)
OT_ASSERT_INT(exp->decimal_digits, col.decimal_digits);
-
if ((exp->num_prec_radix_len == SQL_NULL_DATA) || (exp->num_prec_radix_len ==
SQL_NO_TOTAL))
OT_ASSERT_INT(exp->num_prec_radix_len, col.num_prec_radix_len);
else
@@ -689,7 +689,7 @@
OT_ASSERT_INT(exp->char_octet_length, col.char_octet_length);
if (exp->char_octet_length != SQL_NULL_DATA)
- OT_ASSERT_INT(exp->char_octet_length, col.char_octet_length);
+ OT_ASSERT_INT(exp->char_octet_length, col.char_octet_length);
/* v3 does not set it :-( */
if (col.ordinal_position_len != SQL_NULL_DATA) {
Modified: trunk/testsuites/t_unixodbc_sap/sap_colattrb.c
===================================================================
--- trunk/testsuites/t_unixodbc_sap/sap_colattrb.c 2007-06-07 07:04:39 UTC (rev 130)
+++ trunk/testsuites/t_unixodbc_sap/sap_colattrb.c 2007-06-07 09:20:40 UTC (rev 131)
@@ -23,7 +23,10 @@
"ID", SQL_NTS, /* SQL_DESC_NAME + len */
SQL_NULLABLE, /* SQL_DESC_NULLABLE */
10, /* SQL_DESC_NUM_PREC_RADIX */
- 4 /* SQL_DESC_OCTET_LENGTH */
+ 4, /* SQL_DESC_OCTET_LENGTH */
+ 11, /* SQL_DESC_PRECISION */
+ 0 /* SQL_DESC_SCALE */
+
},
/* stop condition and "documentation" */
{
@@ -49,7 +52,9 @@
"ID", SQL_NTS, /* SQL_DESC_NAME + len */
SQL_NULLABLE, /* SQL_DESC_NULLABLE */
10, /* SQL_DESC_NUM_PREC_RADIX */
- 4 /* SQL_DESC_OCTET_LENGTH */
+ 4, /* SQL_DESC_OCTET_LENGTH */
+ 11, /* SQL_DESC_PRECISION */
+ SQL_NULL_DATA /* SQL_DESC_SCALE */
}
};
@@ -362,6 +367,23 @@
hstmt);
OT_ASSERT_INT(exp->octet_length, col.octet_length);
+ CHECK_SQL_S(ret = SQLColAttribute(hstmt, num_cols, SQL_DESC_PRECISION,
+ (SQLPOINTER)dummy_char,
+ dummy_char_len,
+ &out_len,
+ (SQLPOINTER)&(col.precision)),
+ hstmt);
+ OT_ASSERT_INT(exp->precision, col.precision);
+
+ CHECK_SQL_S(ret = SQLColAttribute(hstmt, num_cols, SQL_DESC_SCALE,
+ (SQLPOINTER)dummy_char,
+ dummy_char_len,
+ &out_len,
+ (SQLPOINTER)&(col.scale)),
+ hstmt);
+ OT_ASSERT_INT(exp->scale, col.scale);
+
+
}
/* SQL_DESC_COUNT */
Deleted: trunk/testsuites/t_unixodbc_sap/sap_todo.c
===================================================================
--- trunk/testsuites/t_unixodbc_sap/sap_todo.c 2007-06-07 07:04:39 UTC (rev 130)
+++ trunk/testsuites/t_unixodbc_sap/sap_todo.c 2007-06-07 09:20:40 UTC (rev 131)
@@ -1,437 +0,0 @@
-#include "t_unixodbc_sap_suite.h"
-
-
-#define TABLE_NAME "todo"
-#define TABLE_ENGINE "InnoDB"
-
-
-
-OT_TEST_METHOD(sap_todo1)
-{
- SQLRETURN ret;
- SQLHANDLE hdbc;
- SQLHANDLE hstmt;
- char msg[1024];
- char msg_detail1[128];
- char msg_detail2[128];
- COLALL_COLUMNS_STRUCT col;
-
- OT_TODO("Isolated problem from sap_collall.c -> C6 FLOAT returns REAL with v3");
- OT_TODO("sap_collall.c passed only because it expects the potentially wrong values");
- OT_TODO("You must fix the expected values in sap_collall.c if this is a bug to correct
the test sap_collall.c");
- OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_colall.c");
- OT_TODO("2007-05-31, v3 issue, see code comments!");
-
- OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
- CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
- hdbc, SQL_HANDLE_DBC);
- OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
-
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE \"" TABLE_NAME "\" (col1
FLOAT) ENGINE=" TABLE_ENGINE, SQL_NTS), hstmt);
- CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
-
- CHECK_SQL_S(SQLColumns(hstmt, NULL, 0, NULL, 0,
- (SQLCHAR*)TABLE_NAME, SQL_NTS,
- NULL, 0), hstmt);
-
- CHECK_SQL_S(SQLBindCol(hstmt, 5, SQL_C_SSHORT,
- &(col.data_type), 0, &(col.data_type_len)), hstmt);
-
- CHECK_SQL_S(SQLFetch(hstmt), hstmt);
-
- OT_ASSERT(col.data_type_len > 0);
- if (SQL_FLOAT != col.data_type)
- {
- unixodbc_sap_sqltype2string(SQL_FLOAT, msg_detail1, sizeof(msg_detail1));
- unixodbc_sap_sqltype2string(col.data_type, msg_detail2, sizeof(msg_detail2));
- snprintf(msg, sizeof(msg), "DATA_TYPE: expecting '%s'/%d got '%s'/%d",
- msg_detail1, SQL_FLOAT, msg_detail2, (int)col.data_type);
- OT_FAIL(msg);
- }
-
- CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
-}
-
-OT_TEST_METHOD(sap_todo2)
-{
- SQLRETURN ret;
- SQLHANDLE hdbc;
- SQLHANDLE hstmt;
- COLALL_COLUMNS_STRUCT col;
-
- OT_TODO("Isolated problem from sap_collall.c/sap_col1.c");
- OT_TODO("sap_collall.c passed because it is ignored. sap_col1.c does not ignore it and
fails");
- OT_TODO("You must fix the above mentioned tests if this is really a bug.");
- OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_col1.c/sap_collall.c");
- OT_TODO("2007-05-31, v3 issue, see code comments!");
-
- OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
- CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
- hdbc, SQL_HANDLE_DBC);
- OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
-
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE \"" TABLE_NAME "\" (col1
FLOAT) ENGINE=" TABLE_ENGINE, SQL_NTS), hstmt);
- CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
-
- CHECK_SQL_S(SQLColumns(hstmt, NULL, 0, NULL, 0,
- (SQLCHAR*)TABLE_NAME, SQL_NTS,
- NULL, 0), hstmt);
-
- CHECK_SQL_S(SQLBindCol(hstmt, 17, SQL_C_SLONG,
- &(col.ordinal_position), 0, &(col.ordinal_position_len)),
hstmt);
-
- CHECK_SQL_S(SQLFetch(hstmt), hstmt);
-
- OT_ASSERT(col.ordinal_position_len > 0);
- OT_ASSERT_INT(1, col.ordinal_position);
-
- CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
-}
-
-OT_TEST_METHOD(sap_todo3)
-{
- SQLRETURN ret;
- SQLHANDLE hdbc;
- SQLHANDLE hstmt;
- COLALL_COLUMNS_STRUCT col;
-
- OT_TODO("Isolated problem from sap_collall.c");
- OT_TODO("Is there no driver defined constant for the SQL data type?");
- OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_collall.c");
- OT_TODO("2007-06-01, v3 issue, see code comments!");
-
- OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
- CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
- hdbc, SQL_HANDLE_DBC);
- OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
-
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE \"" TABLE_NAME "\" (col1 LONG)
ENGINE=" TABLE_ENGINE, SQL_NTS), hstmt);
- CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
-
- CHECK_SQL_S(SQLColumns(hstmt, NULL, 0, NULL, 0,
- (SQLCHAR*)TABLE_NAME, SQL_NTS,
- NULL, 0), hstmt);
-
- CHECK_SQL_S(SQLBindCol(hstmt, 5, SQL_C_SSHORT,
- &(col.data_type), 0, &(col.data_type_len)), hstmt);
-
- CHECK_SQL_S(SQLFetch(hstmt), hstmt);
-
- OT_ASSERT(col.data_type_len > 0);
- /* Is there no constant ? Does one really have to use the value 65535. If so, please
document. */
- OT_ASSERT_INT(65535, col.data_type);
-
- CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
-}
-
-OT_TEST_METHOD(sap_todo4)
-{
- SQLRETURN ret;
- SQLHANDLE hdbc;
- SQLHANDLE hstmt;
- COLALL_COLUMNS_STRUCT col;
-
- OT_TODO("Isolated problem from sap_collall.c");
- OT_TODO("Is there no driver defined constant for the SQL data type?");
- OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_collall.c");
- OT_TODO("2007-06-04, v3 issue, see code comments!");
-
- OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
- CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
- hdbc, SQL_HANDLE_DBC);
- OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
-
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE \"" TABLE_NAME "\" (col1 TEXT)
ENGINE=" TABLE_ENGINE, SQL_NTS), hstmt);
- CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
-
- CHECK_SQL_S(SQLColumns(hstmt, NULL, 0, NULL, 0,
- (SQLCHAR*)TABLE_NAME, SQL_NTS,
- NULL, 0), hstmt);
-
- CHECK_SQL_S(SQLBindCol(hstmt, 5, SQL_C_SSHORT,
- &(col.data_type), 0, &(col.data_type_len)), hstmt);
-
- CHECK_SQL_S(SQLFetch(hstmt), hstmt);
-
- OT_ASSERT(col.data_type_len > 0);
- /* Is there no constant ? Does one really have to use the value 65532. If so, please
document. */
- OT_ASSERT_INT(65532, col.data_type);
-
- CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
-}
-
-OT_TEST_METHOD(sap_todo5)
-{
- SQLRETURN ret;
- SQLHANDLE hdbc;
- SQLHANDLE hstmt;
- char msg[1024];
- char msg_detail1[128];
- char msg_detail2[128];
- COLALL_COLUMNS_STRUCT col;
-
- OT_TODO("Isolated problem from sap_collall.c");
- OT_TODO("Why does this not indicate SQL_TINYINT or any other known type?");
- OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_collall.c");
- OT_TODO("Fix sap_collall.c/C16 - it's using a wrong sql type to pass.");
- OT_TODO("2007-06-01, v3 issue, see code comments!");
-
- OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
- CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
- hdbc, SQL_HANDLE_DBC);
- OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
-
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE \"" TABLE_NAME "\" (col1
TINYINT) ENGINE=" TABLE_ENGINE, SQL_NTS), hstmt);
- CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
-
- CHECK_SQL_S(SQLColumns(hstmt, NULL, 0, NULL, 0,
- (SQLCHAR*)TABLE_NAME, SQL_NTS,
- NULL, 0), hstmt);
-
- CHECK_SQL_S(SQLBindCol(hstmt, 5, SQL_C_SSHORT,
- &(col.data_type), 0, &(col.data_type_len)), hstmt);
-
- CHECK_SQL_S(SQLFetch(hstmt), hstmt);
-
- unixodbc_sap_sqltype2string(SQL_TINYINT, msg_detail1, sizeof(msg_detail1));
- unixodbc_sap_sqltype2string(col.data_type, msg_detail2, sizeof(msg_detail2));
- snprintf(msg, sizeof(msg), "Expecting '%s'/%d got '%s'/%d",
- msg_detail1, (int)SQL_TINYINT, msg_detail2, (int)col.data_type);
-
- OT_ASSERT(col.data_type_len > 0);
- /* Is there no constant ? Does one really have to use the value 65532. If so, please
document. */
- OT_ASSERT_INT(SQL_TINYINT, col.data_type);
-
- CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
-}
-
-OT_TEST_METHOD(sap_todo6)
-{
- SQLRETURN ret;
- SQLHANDLE hdbc;
- SQLHANDLE hstmt;
- COLALL_COLUMNS_STRUCT col;
-
- OT_TODO("Isolated problem from sap_collall.c");
- OT_TODO("Strange CHAR_OCTET_LENGTH: I'd be fine with 1, 2 or SQL_NULL_DATA but 16M?");
- OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_collall.c");
- OT_TODO("Fix sap_collall.c/C16 - it's using a wrong length to pass.");
- OT_TODO("2007-06-01, v3 issue, see code comments!");
-
- OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
- CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
- hdbc, SQL_HANDLE_DBC);
- OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
-
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE \"" TABLE_NAME "\" (col1
TINYINT) ENGINE=" TABLE_ENGINE, SQL_NTS), hstmt);
- CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
-
- CHECK_SQL_S(SQLColumns(hstmt, NULL, 0, NULL, 0,
- (SQLCHAR*)TABLE_NAME, SQL_NTS,
- NULL, 0), hstmt);
-
- CHECK_SQL_S(SQLBindCol(hstmt, 5, SQL_C_SSHORT,
- &(col.data_type), 0, &(col.data_type_len)), hstmt);
-
- CHECK_SQL_S(SQLFetch(hstmt), hstmt);
-
- OT_ASSERT(col.data_type_len > 0);
- /* Is there no constant ? Does one really have to use the value 65532. If so, please
document. */
- if (col.char_octet_length != SQL_NULL_DATA)
- OT_ASSERT(col.char_octet_length <= 2);
-
- CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
-}
-
-OT_TEST_METHOD(sap_todo7)
-{
- SQLRETURN ret;
- SQLHANDLE hdbc;
- SQLHANDLE hstmt;
- COLLATTRB_STRUCT col;
- SQLCHAR dummy_char[10];
- SQLSMALLINT dummy_char_len;
- SQLSMALLINT out_len;
-
- dummy_char_len = (SQLSMALLINT)sizeof(dummy_char);
-
- OT_TODO("Isolated problem from sap_collattrb.c");
- OT_TODO("ID is not an auto increment column");
- OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_collattrb.c");
- OT_TODO("2007-06-04, v5 issue, see code comments!");
-
- OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
- dummy_char_len = (SQLSMALLINT)sizeof(dummy_char);
-
- CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
- hdbc, SQL_HANDLE_DBC);
- OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
-
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE " TABLE_NAME " ("
- "ID INTEGER "
- ") ENGINE = " TABLE_ENGINE, SQL_NTS), hstmt);
- CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt,
- (SQLCHAR*)"INSERT INTO " TABLE_NAME " VALUES (10)",
- SQL_NTS),
- hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"SELECT * FROM " TABLE_NAME, SQL_NTS),
hstmt);
-
- CHECK_SQL_S(ret = SQLColAttribute(hstmt, 1, SQL_DESC_AUTO_UNIQUE_VALUE,
- (SQLPOINTER)&dummy_char,
- dummy_char_len,
- &out_len,
- (SQLPOINTER)&(col.auto_unique_value)), hstmt);
-
- /* this is not an auto increment column */
- OT_ASSERT_INT(SQL_FALSE, col.auto_unique_value);
-
- CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
-}
-
-OT_TEST_METHOD(sap_todo8)
-{
- SQLRETURN ret;
- SQLHANDLE hdbc;
- SQLHANDLE hstmt;
- COLLATTRB_STRUCT col;
- SQLCHAR dummy_char[10];
- SQLSMALLINT dummy_char_len;
- SQLSMALLINT out_len;
-
- OT_TODO("Isolated problem from sap_collattrb.c");
- OT_TODO("Display size: SQL_INTEGER - 11 if signed (a sign and 10 digits) or 10 if
unsigned (10 digits).");
- OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_collattrb.c");
- OT_TODO("2007-06-05, v3 issue, see code comments!");
-
- OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
- CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
- hdbc, SQL_HANDLE_DBC);
- OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
-
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE " TABLE_NAME " ("
- "ID INTEGER "
- ") ENGINE = " TABLE_ENGINE, SQL_NTS), hstmt);
- CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt,
- (SQLCHAR*)"INSERT INTO " TABLE_NAME " VALUES (10)",
- SQL_NTS),
- hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"SELECT * FROM " TABLE_NAME, SQL_NTS),
hstmt);
-
- CHECK_SQL_S(ret = SQLColAttribute(hstmt, 1, SQL_DESC_DISPLAY_SIZE,
- (SQLPOINTER)&dummy_char,
- dummy_char_len,
- &out_len,
- (SQLPOINTER)&(col.display_size)), hstmt);
-
- OT_ASSERT_INT(11, col.display_size);
-
- CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
-}
-
-
-OT_TEST_METHOD(sap_todo9)
-{
- SQLRETURN ret;
- SQLHANDLE hdbc;
- SQLHANDLE hstmt;
- COLLATTRB_STRUCT col;
- SQLINTEGER dummy_num;
- SQLSMALLINT out_len;
- char catalog[COLATTRB_STR_LEN];
-
- OT_TODO("Isolated problem from sap_collattrb.c");
- OT_TODO("Catalog name equals database name with v3 (sensible value) but is 'def' with
v5");
- OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_collattrb.c");
- OT_TODO("2007-06-06, v5 issue, see code comments!");
-
- OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
- if (unixodbc_sap_get_catalog(hdbc, catalog, sizeof(catalog)))
- OT_FAIL(catalog);
-
- CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
- hdbc, SQL_HANDLE_DBC);
- OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
-
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE " TABLE_NAME " ("
- "ID INTEGER "
- ") ENGINE = " TABLE_ENGINE, SQL_NTS), hstmt);
- CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt,
- (SQLCHAR*)"INSERT INTO " TABLE_NAME " VALUES (10)",
- SQL_NTS),
- hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"SELECT * FROM " TABLE_NAME, SQL_NTS),
hstmt);
-
- CHECK_SQL_S(ret = SQLColAttribute(hstmt, 1, SQL_DESC_CATALOG_NAME,
- (SQLPOINTER)col.catalog_name,
- (SQLSMALLINT)sizeof(col.catalog_name),
- &out_len,
- (SQLPOINTER)&dummy_num), hstmt);
-
- test_printf("CATALOG_NAME: Expecting '%s' got '%s'", catalog, col.catalog_name);
- OT_ASSERT(0 == strncmp(catalog, col.catalog_name, strlen(catalog)));
-
- CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
-
-}
-
-OT_TEST_METHOD(sap_todo10)
-{
- SQLRETURN ret;
- SQLHANDLE hdbc;
- SQLHANDLE hstmt;
- COLLATTRB_STRUCT col;
- SQLCHAR dummy_char[10];
- SQLSMALLINT dummy_char_len;
- SQLSMALLINT out_len;
-
- OT_TODO("Isolated problem from sap_collattrb.c, should also affect sap_collall.c");
- OT_TODO("Why does v4 return 4 for the length and v5 returns 11?");
- OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_collattrb.c");
- OT_TODO("2007-06-05, v3 or v5 issue, see code comments!");
-
- OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
- CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
- hdbc, SQL_HANDLE_DBC);
- OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
-
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE " TABLE_NAME " ("
- "ID INTEGER "
- ") ENGINE = " TABLE_ENGINE, SQL_NTS), hstmt);
- CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt,
- (SQLCHAR*)"INSERT INTO " TABLE_NAME " VALUES (10)",
- SQL_NTS),
- hstmt);
- CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"SELECT * FROM " TABLE_NAME, SQL_NTS),
hstmt);
-
- CHECK_SQL_S(ret = SQLColAttribute(hstmt, 1, SQL_DESC_LENGTH,
- (SQLPOINTER)&dummy_char,
- dummy_char_len,
- &out_len,
- (SQLPOINTER)&(col.length)), hstmt);
-
- /* this should pass with v3 */
- OT_ASSERT_INT(4, col.length);
- /* this should pass with v5 */
- OT_ASSERT_INT(11, col.length);
-
- CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
-}
-
-OT_TEST_METHOD(sap_todo11)
-{
- OT_TODO("Dummy");
-}
Added: trunk/testsuites/t_unixodbc_sap/sap_todo_v3.c
===================================================================
--- trunk/testsuites/t_unixodbc_sap/sap_todo_v3.c 2007-06-07 07:04:39 UTC (rev 130)
+++ trunk/testsuites/t_unixodbc_sap/sap_todo_v3.c 2007-06-07 09:20:40 UTC (rev 131)
@@ -0,0 +1,309 @@
+#include "t_unixodbc_sap_suite.h"
+
+#define TABLE_NAME "todo_v3"
+#define TABLE_ENGINE "InnoDB"
+
+OT_TEST_METHOD(sap_todo1)
+{
+ SQLRETURN ret;
+ SQLHANDLE hdbc;
+ SQLHANDLE hstmt;
+ char msg[1024];
+ char msg_detail1[128];
+ char msg_detail2[128];
+ COLALL_COLUMNS_STRUCT col;
+
+ OT_TODO("Isolated problem from sap_collall.c -> C6 FLOAT returns REAL with v3");
+ OT_TODO("sap_collall.c passed only because it expects the potentially wrong values");
+ OT_TODO("You must fix the expected values in sap_collall.c if this is a bug to correct
the test sap_collall.c");
+ OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_colall.c");
+ OT_TODO("2007-05-31, v3 issue, see code comments!");
+
+ OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
+ CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
+ hdbc, SQL_HANDLE_DBC);
+ OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
+
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE \"" TABLE_NAME "\" (col1
FLOAT) ENGINE=" TABLE_ENGINE, SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
+
+ CHECK_SQL_S(SQLColumns(hstmt, NULL, 0, NULL, 0,
+ (SQLCHAR*)TABLE_NAME, SQL_NTS,
+ NULL, 0), hstmt);
+
+ CHECK_SQL_S(SQLBindCol(hstmt, 5, SQL_C_SSHORT,
+ &(col.data_type), 0, &(col.data_type_len)), hstmt);
+
+ CHECK_SQL_S(SQLFetch(hstmt), hstmt);
+
+ OT_ASSERT(col.data_type_len > 0);
+ if (SQL_FLOAT != col.data_type)
+ {
+ unixodbc_sap_sqltype2string(SQL_FLOAT, msg_detail1, sizeof(msg_detail1));
+ unixodbc_sap_sqltype2string(col.data_type, msg_detail2, sizeof(msg_detail2));
+ snprintf(msg, sizeof(msg), "DATA_TYPE: expecting '%s'/%d got '%s'/%d",
+ msg_detail1, SQL_FLOAT, msg_detail2, (int)col.data_type);
+ OT_FAIL(msg);
+ }
+
+ CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
+}
+
+OT_TEST_METHOD(sap_todo2)
+{
+ SQLRETURN ret;
+ SQLHANDLE hdbc;
+ SQLHANDLE hstmt;
+ COLALL_COLUMNS_STRUCT col;
+
+ OT_TODO("Isolated problem from sap_collall.c/sap_col1.c");
+ OT_TODO("sap_collall.c passed because it is ignored. sap_col1.c does not ignore it and
fails");
+ OT_TODO("You must fix the above mentioned tests if this is really a bug.");
+ OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_col1.c/sap_collall.c");
+ OT_TODO("2007-05-31, v3 issue, see code comments!");
+
+ OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
+ CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
+ hdbc, SQL_HANDLE_DBC);
+ OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
+
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE \"" TABLE_NAME "\" (col1
FLOAT) ENGINE=" TABLE_ENGINE, SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
+
+ CHECK_SQL_S(SQLColumns(hstmt, NULL, 0, NULL, 0,
+ (SQLCHAR*)TABLE_NAME, SQL_NTS,
+ NULL, 0), hstmt);
+
+ CHECK_SQL_S(SQLBindCol(hstmt, 17, SQL_C_SLONG,
+ &(col.ordinal_position), 0, &(col.ordinal_position_len)),
hstmt);
+
+ CHECK_SQL_S(SQLFetch(hstmt), hstmt);
+
+ OT_ASSERT(col.ordinal_position_len > 0);
+ OT_ASSERT_INT(1, col.ordinal_position);
+
+ CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
+}
+
+OT_TEST_METHOD(sap_todo3)
+{
+ SQLRETURN ret;
+ SQLHANDLE hdbc;
+ SQLHANDLE hstmt;
+ COLALL_COLUMNS_STRUCT col;
+
+ OT_TODO("Isolated problem from sap_collall.c");
+ OT_TODO("Is there no driver defined constant for the SQL data type?");
+ OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_collall.c");
+ OT_TODO("2007-06-01, v3 issue, see code comments!");
+
+ OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
+ CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
+ hdbc, SQL_HANDLE_DBC);
+ OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
+
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE \"" TABLE_NAME "\" (col1 LONG)
ENGINE=" TABLE_ENGINE, SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
+
+ CHECK_SQL_S(SQLColumns(hstmt, NULL, 0, NULL, 0,
+ (SQLCHAR*)TABLE_NAME, SQL_NTS,
+ NULL, 0), hstmt);
+
+ CHECK_SQL_S(SQLBindCol(hstmt, 5, SQL_C_SSHORT,
+ &(col.data_type), 0, &(col.data_type_len)), hstmt);
+
+ CHECK_SQL_S(SQLFetch(hstmt), hstmt);
+
+ OT_ASSERT(col.data_type_len > 0);
+ /* Is there no constant ? Does one really have to use the value 65535. If so, please
document. */
+ OT_ASSERT_INT(65535, col.data_type);
+ /* let it fail */
+ OT_ASSERT_INT(0, col.data_type);
+
+ CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
+}
+
+OT_TEST_METHOD(sap_todo4)
+{
+ SQLRETURN ret;
+ SQLHANDLE hdbc;
+ SQLHANDLE hstmt;
+ COLALL_COLUMNS_STRUCT col;
+
+ OT_TODO("Isolated problem from sap_collall.c");
+ OT_TODO("Is there no driver defined constant for the SQL data type?");
+ OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_collall.c");
+ OT_TODO("2007-06-04, v3 issue, see code comments!");
+
+ OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
+ CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
+ hdbc, SQL_HANDLE_DBC);
+ OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
+
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE \"" TABLE_NAME "\" (col1 TEXT)
ENGINE=" TABLE_ENGINE, SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
+
+ CHECK_SQL_S(SQLColumns(hstmt, NULL, 0, NULL, 0,
+ (SQLCHAR*)TABLE_NAME, SQL_NTS,
+ NULL, 0), hstmt);
+
+ CHECK_SQL_S(SQLBindCol(hstmt, 5, SQL_C_SSHORT,
+ &(col.data_type), 0, &(col.data_type_len)), hstmt);
+
+ CHECK_SQL_S(SQLFetch(hstmt), hstmt);
+
+ OT_ASSERT(col.data_type_len > 0);
+ /* Is there no constant ? Does one really have to use the value 65535. If so, please
document. */
+ OT_ASSERT_INT(65535, col.data_type);
+ /* let the test fail */
+ OT_ASSERT_INT(0, col.data_type);
+
+ CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
+}
+
+OT_TEST_METHOD(sap_todo5)
+{
+ SQLRETURN ret;
+ SQLHANDLE hdbc;
+ SQLHANDLE hstmt;
+ char msg[1024];
+ char msg_detail1[128];
+ char msg_detail2[128];
+ COLALL_COLUMNS_STRUCT col;
+
+ OT_TODO("Isolated problem from sap_collall.c");
+ OT_TODO("Why does this not indicate SQL_TINYINT or any other known type?");
+ OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_collall.c");
+ OT_TODO("Fix sap_collall.c/C16 - it's using a wrong sql type to pass.");
+ OT_TODO("2007-06-01, v3 issue, see code comments!");
+
+ OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
+ CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
+ hdbc, SQL_HANDLE_DBC);
+ OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
+
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE \"" TABLE_NAME "\" (col1
TINYINT) ENGINE=" TABLE_ENGINE, SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
+
+ CHECK_SQL_S(SQLColumns(hstmt, NULL, 0, NULL, 0,
+ (SQLCHAR*)TABLE_NAME, SQL_NTS,
+ NULL, 0), hstmt);
+
+ CHECK_SQL_S(SQLBindCol(hstmt, 5, SQL_C_SSHORT,
+ &(col.data_type), 0, &(col.data_type_len)), hstmt);
+
+ CHECK_SQL_S(SQLFetch(hstmt), hstmt);
+
+ unixodbc_sap_sqltype2string(SQL_TINYINT, msg_detail1, sizeof(msg_detail1));
+ unixodbc_sap_sqltype2string(col.data_type, msg_detail2, sizeof(msg_detail2));
+ snprintf(msg, sizeof(msg), "Expecting '%s'/%d got '%s'/%d",
+ msg_detail1, (int)SQL_TINYINT, msg_detail2, (int)col.data_type);
+
+ OT_ASSERT(col.data_type_len > 0);
+ /* this will fail */
+ OT_ASSERT_INT(SQL_TINYINT, col.data_type);
+ /* this will pass - but why does the constant not work */
+ OT_ASSERT_INT(65530, col.data_type);
+
+ CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
+}
+
+OT_TEST_METHOD(sap_todo6)
+{
+ SQLRETURN ret;
+ SQLHANDLE hdbc;
+ SQLHANDLE hstmt;
+ COLALL_COLUMNS_STRUCT col;
+
+ OT_TODO("Isolated problem from sap_collall.c");
+ OT_TODO("Strange CHAR_OCTET_LENGTH: I'd be fine with 1, 2 or SQL_NULL_DATA but 16M?");
+ OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_collall.c");
+ OT_TODO("Fix sap_collall.c/C16 - it's using a wrong length to pass.");
+ OT_TODO("2007-06-01, v3 issue, see code comments!");
+
+ OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
+ CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
+ hdbc, SQL_HANDLE_DBC);
+ OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
+
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE \"" TABLE_NAME "\" (C15 LONG
BYTE, C16 BOOLEAN) ENGINE=" TABLE_ENGINE, SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
+
+ CHECK_SQL_S(SQLColumns(hstmt, NULL, 0, NULL, 0,
+ (SQLCHAR*)TABLE_NAME, SQL_NTS,
+ NULL, 0), hstmt);
+
+ CHECK_SQL_S(SQLBindCol(hstmt, 16, SQL_C_SLONG,
+ &(col.char_octet_length), 0,
&(col.char_octet_length_len)), hstmt);
+
+ CHECK_SQL_S(SQLFetch(hstmt), hstmt);
+ test_printf("char_octet_length for C15 LONG BYTE is %d\n", col.char_octet_length);
+ CHECK_SQL_S(SQLFetch(hstmt), hstmt);
+ test_printf("char_octet_length for C16 BOOLEAN is %d\n", col.char_octet_length);
+ test_printf("Not reset? No SQL_NULL_DATA flag set?");
+
+ OT_ASSERT(col.char_octet_length_len != SQL_NULL_DATA);
+ if (col.char_octet_length != SQL_NULL_DATA)
+ OT_ASSERT(col.char_octet_length <= 2);
+
+ CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
+}
+
+OT_TEST_METHOD(sap_todo8)
+{
+ SQLRETURN ret;
+ SQLHANDLE hdbc;
+ SQLHANDLE hstmt;
+ COLLATTRB_STRUCT col;
+ SQLCHAR dummy_char[10];
+ SQLSMALLINT dummy_char_len;
+ SQLSMALLINT out_len;
+
+ OT_TODO("Isolated problem from sap_collattrb.c");
+ OT_TODO("Display size: SQL_INTEGER - 11 if signed (a sign and 10 digits) or 10 if
unsigned (10 digits).");
+ OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_collattrb.c");
+ OT_TODO("2007-06-05, v3 issue, see code comments!");
+
+ OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
+ CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
+ hdbc, SQL_HANDLE_DBC);
+ OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
+
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE " TABLE_NAME " ("
+ "ID INTEGER "
+ ") ENGINE = " TABLE_ENGINE, SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt,
+ (SQLCHAR*)"INSERT INTO " TABLE_NAME " VALUES (10)",
+ SQL_NTS),
+ hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"SELECT * FROM " TABLE_NAME, SQL_NTS),
hstmt);
+
+ CHECK_SQL_S(ret = SQLColAttribute(hstmt, 1, SQL_DESC_DISPLAY_SIZE,
+ (SQLPOINTER)&dummy_char,
+ dummy_char_len,
+ &out_len,
+ (SQLPOINTER)&(col.display_size)), hstmt);
+
+ /* v3 will pass this */
+ OT_ASSERT_INT(2, col.display_size);
+ /* v5 will pass this */
+ OT_ASSERT_INT(11, col.display_size);
+ /* msdn says SQL_INTEGER 11 if signed (a sign and 10 digits) or 10 if unsigned (10
digits).*/
+ OT_ASSERT_INT(11, col.display_size);
+
+ CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
+}
+
+
+OT_TEST_METHOD(sap_todo11)
+{
+ OT_FAIL("Dummy");
+}
\ No newline at end of file
Added: trunk/testsuites/t_unixodbc_sap/sap_todo_v3_v5.c
===================================================================
--- trunk/testsuites/t_unixodbc_sap/sap_todo_v3_v5.c 2007-06-07 07:04:39 UTC (rev 130)
+++ trunk/testsuites/t_unixodbc_sap/sap_todo_v3_v5.c 2007-06-07 09:20:40 UTC (rev 131)
@@ -0,0 +1,49 @@
+#include "t_unixodbc_sap_suite.h"
+
+#define TABLE_NAME "todo_v3_v5"
+#define TABLE_ENGINE "InnoDB"
+
+OT_TEST_METHOD(sap_todo10)
+{
+ SQLRETURN ret;
+ SQLHANDLE hdbc;
+ SQLHANDLE hstmt;
+ COLLATTRB_STRUCT col;
+ SQLCHAR dummy_char[10];
+ SQLSMALLINT dummy_char_len;
+ SQLSMALLINT out_len;
+
+ OT_TODO("Isolated problem from sap_collattrb.c, should also affect sap_collall.c");
+ OT_TODO("Why does v4 return 4 for the length and v5 returns 11?");
+ OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_collattrb.c");
+ OT_TODO("2007-06-05, v3 or v5 issue, see code comments!");
+
+ OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
+ CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
+ hdbc, SQL_HANDLE_DBC);
+ OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
+
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE " TABLE_NAME " ("
+ "ID INTEGER "
+ ") ENGINE = " TABLE_ENGINE, SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt,
+ (SQLCHAR*)"INSERT INTO " TABLE_NAME " VALUES (10)",
+ SQL_NTS),
+ hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"SELECT * FROM " TABLE_NAME, SQL_NTS),
hstmt);
+
+ CHECK_SQL_S(ret = SQLColAttribute(hstmt, 1, SQL_DESC_LENGTH,
+ (SQLPOINTER)&dummy_char,
+ dummy_char_len,
+ &out_len,
+ (SQLPOINTER)&(col.length)), hstmt);
+
+ /* this should pass with v3 */
+ OT_ASSERT_INT(4, col.length);
+ /* this should pass with v5 */
+ OT_ASSERT_INT(11, col.length);
+
+ CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
+}
Added: trunk/testsuites/t_unixodbc_sap/sap_todo_v5.c
===================================================================
--- trunk/testsuites/t_unixodbc_sap/sap_todo_v5.c 2007-06-07 07:04:39 UTC (rev 130)
+++ trunk/testsuites/t_unixodbc_sap/sap_todo_v5.c 2007-06-07 09:20:40 UTC (rev 131)
@@ -0,0 +1,141 @@
+#include "t_unixodbc_sap_suite.h"
+
+#define TABLE_NAME "todo_v5"
+#define TABLE_ENGINE "InnoDB"
+
+OT_TEST_METHOD(sap_todo7)
+{
+ SQLRETURN ret;
+ SQLHANDLE hdbc;
+ SQLHANDLE hstmt;
+ COLLATTRB_STRUCT col;
+ SQLCHAR dummy_char[10];
+ SQLSMALLINT dummy_char_len;
+ SQLSMALLINT out_len;
+
+ dummy_char_len = (SQLSMALLINT)sizeof(dummy_char);
+
+ OT_TODO("Isolated problem from sap_collattrb.c");
+ OT_TODO("ID is not an auto increment column");
+ OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_collattrb.c");
+ OT_TODO("2007-06-04, v5 issue, see code comments!");
+
+ OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
+ dummy_char_len = (SQLSMALLINT)sizeof(dummy_char);
+
+ CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
+ hdbc, SQL_HANDLE_DBC);
+ OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
+
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE " TABLE_NAME " ("
+ "ID INTEGER "
+ ") ENGINE = " TABLE_ENGINE, SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt,
+ (SQLCHAR*)"INSERT INTO " TABLE_NAME " VALUES (10)",
+ SQL_NTS),
+ hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"SELECT * FROM " TABLE_NAME, SQL_NTS),
hstmt);
+
+ CHECK_SQL_S(ret = SQLColAttribute(hstmt, 1, SQL_DESC_AUTO_UNIQUE_VALUE,
+ (SQLPOINTER)&dummy_char,
+ dummy_char_len,
+ &out_len,
+ (SQLPOINTER)&(col.auto_unique_value)), hstmt);
+
+ /* this is not an auto increment column */
+ OT_ASSERT_INT(SQL_FALSE, col.auto_unique_value);
+
+ CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
+}
+
+OT_TEST_METHOD(sap_todo9)
+{
+ SQLRETURN ret;
+ SQLHANDLE hdbc;
+ SQLHANDLE hstmt;
+ COLLATTRB_STRUCT col;
+ SQLINTEGER dummy_num;
+ SQLSMALLINT out_len;
+ char catalog[COLATTRB_STR_LEN];
+
+ OT_TODO("Isolated problem from sap_collattrb.c");
+ OT_TODO("Catalog name equals database name with v3 (sensible value) but is 'def' with
v5");
+ OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_collattrb.c");
+ OT_TODO("2007-06-06, v5 issue, see code comments!");
+
+ OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
+ if (unixodbc_sap_get_catalog(hdbc, catalog, sizeof(catalog)))
+ OT_FAIL(catalog);
+
+ CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
+ hdbc, SQL_HANDLE_DBC);
+ OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
+
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE " TABLE_NAME " ("
+ "ID INTEGER "
+ ") ENGINE = " TABLE_ENGINE, SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt,
+ (SQLCHAR*)"INSERT INTO " TABLE_NAME " VALUES (10)",
+ SQL_NTS),
+ hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"SELECT * FROM " TABLE_NAME, SQL_NTS),
hstmt);
+
+ CHECK_SQL_S(ret = SQLColAttribute(hstmt, 1, SQL_DESC_CATALOG_NAME,
+ (SQLPOINTER)col.catalog_name,
+ (SQLSMALLINT)sizeof(col.catalog_name),
+ &out_len,
+ (SQLPOINTER)&dummy_num), hstmt);
+
+ test_printf("CATALOG_NAME: Expecting '%s' got '%s'", catalog, col.catalog_name);
+ OT_ASSERT(0 == strncmp(catalog, col.catalog_name, strlen(catalog)));
+
+ CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
+
+}
+
+OT_TEST_METHOD(sap_todo12)
+{
+ SQLRETURN ret;
+ SQLHANDLE hdbc;
+ SQLHANDLE hstmt;
+ COLLATTRB_STRUCT col;
+ SQLCHAR dummy_char[10];
+ SQLSMALLINT dummy_char_len;
+ SQLSMALLINT out_len;
+
+ OT_TODO("Isolated problem from sap_collattrb.c");
+ OT_TODO("SQLColAttribute() call fails with v5 but not with v3");
+ OT_TODO("Remove this test code after verficiation, it's nothing but a part of
sap_collattrb.c");
+ OT_TODO("2007-06-06, v5 issue, see code comments!");
+
+ OT_ASSERT(unixodbc_sap_get_dbc_handle(&hdbc));
+ CHECK_SQL(ret = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt),
+ hdbc, SQL_HANDLE_DBC);
+ OT_ASSERT_INT_MSG("SQLAllocHandle()", SQL_SUCCESS, ret);
+
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"DROP TABLE IF EXISTS \"" TABLE_NAME "\"",
SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"CREATE TABLE " TABLE_NAME " ("
+ "ID INTEGER "
+ ") ENGINE = " TABLE_ENGINE, SQL_NTS), hstmt);
+ CHECK_SQL_S(SQLFreeStmt(hstmt, SQL_CLOSE), hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt,
+ (SQLCHAR*)"INSERT INTO " TABLE_NAME " VALUES (10)",
+ SQL_NTS),
+ hstmt);
+ CHECK_SQL_S(SQLExecDirect(hstmt, (SQLCHAR*)"SELECT * FROM " TABLE_NAME, SQL_NTS),
hstmt);
+
+ CHECK_SQL_S(ret = SQLColAttribute(hstmt, 1, SQL_DESC_NUM_PREC_RADIX,
+ (SQLPOINTER)dummy_char,
+ dummy_char_len,
+ &out_len,
+ (SQLPOINTER)&(col.num_prec_radix)),
+ hstmt);
+ OT_ASSERT((10 == col.num_prec_radix) || (2 == col.num_prec_radix));
+
+ CHECK_SQL_S(SQLFreeHandle(SQL_HANDLE_STMT, hstmt), hstmt);
+}
+
Modified: trunk/testsuites/t_unixodbc_sap/t_unixodbc_sap_suite.c
===================================================================
--- trunk/testsuites/t_unixodbc_sap/t_unixodbc_sap_suite.c 2007-06-07 07:04:39 UTC (rev
130)
+++ trunk/testsuites/t_unixodbc_sap/t_unixodbc_sap_suite.c 2007-06-07 09:20:40 UTC (rev
131)
@@ -434,7 +434,7 @@
*/
OT_TEST_TEARDOWN(unixodbc_sap_teardown)
{
- global_disconnect();
+ /* global_disconnect(); */
}
/*
@@ -458,7 +458,7 @@
OT_SUITE_ADD_TEST(sap_col1, unixodbc_sap_setup, unixodbc_sap_teardown);
OT_SUITE_ADD_TEST(sap_cola, unixodbc_sap_setup, unixodbc_sap_teardown);
OT_SUITE_ADD_TEST(sap_colall, unixodbc_sap_setup, unixodbc_sap_teardown);
-/* OT_SUITE_ADD_TEST(sap_colattrb, unixodbc_sap_setup, unixodbc_sap_teardown);*/
+ OT_SUITE_ADD_TEST(sap_colattrb, unixodbc_sap_setup, unixodbc_sap_teardown);
/* these one are isolated snippets with potential bugs from the larger tests above */
OT_SUITE_ADD_TEST(sap_todo1, unixodbc_sap_setup, unixodbc_sap_teardown);
@@ -472,4 +472,5 @@
OT_SUITE_ADD_TEST(sap_todo9, unixodbc_sap_setup, unixodbc_sap_teardown);
OT_SUITE_ADD_TEST(sap_todo10, unixodbc_sap_setup, unixodbc_sap_teardown);
OT_SUITE_ADD_TEST(sap_todo11, unixodbc_sap_setup, unixodbc_sap_teardown);
+ OT_SUITE_ADD_TEST(sap_todo12, unixodbc_sap_setup, unixodbc_sap_teardown);
OT_SUITE_REGISTER_END
Modified: trunk/testsuites/t_unixodbc_sap/t_unixodbc_sap_suite.h
===================================================================
--- trunk/testsuites/t_unixodbc_sap/t_unixodbc_sap_suite.h 2007-06-07 07:04:39 UTC (rev
130)
+++ trunk/testsuites/t_unixodbc_sap/t_unixodbc_sap_suite.h 2007-06-07 09:20:40 UTC (rev
131)
@@ -199,19 +199,27 @@
SQLINTEGER nullable; /* SQL_DESC_NULLABLE */
SQLINTEGER num_prec_radix; /* SQL_DESC_NUM_PREC_RADIX */
SQLINTEGER octet_length; /* SQL_DESC_OCTET_LENGTH */
+ SQLINTEGER precision; /* SQL_DESC_PRECISION */
+ SQLINTEGER scale; /* SQL_DESC_SCALE */
} COLLATTRB_STRUCT;
-/*OT_TEST_METHOD(sap_colattrb);*/
+OT_TEST_METHOD(sap_colattrb);
-/* sap_todo.c */
+/* sap_todo_v3_v5 */
+OT_TEST_METHOD(sap_todo10);
+
+/* sap_todo_v3.c */
OT_TEST_METHOD(sap_todo1);
OT_TEST_METHOD(sap_todo2);
OT_TEST_METHOD(sap_todo3);
OT_TEST_METHOD(sap_todo4);
OT_TEST_METHOD(sap_todo5);
OT_TEST_METHOD(sap_todo6);
+OT_TEST_METHOD(sap_todo8);
+/* dummy */
+OT_TEST_METHOD(sap_todo11);
+
+/* sap_todo_v5.c */
OT_TEST_METHOD(sap_todo7);
-OT_TEST_METHOD(sap_todo8);
OT_TEST_METHOD(sap_todo9);
-OT_TEST_METHOD(sap_todo10);
-OT_TEST_METHOD(sap_todo11);
+OT_TEST_METHOD(sap_todo12);
\ No newline at end of file
| Thread |
|---|
| • ODBC C-tests commit: r131 - trunk/testsuites/t_unixodbc_sap | uwendel | 7 Jun |