diff --git a/src/connector/odbc/tests/CMakeLists.txt b/src/connector/odbc/tests/CMakeLists.txt index d777bf72eeea594b7ffe7928c6dcaa58adacf275..cb159a79abda1798935d06b92a8f69c0983ab916 100644 --- a/src/connector/odbc/tests/CMakeLists.txt +++ b/src/connector/odbc/tests/CMakeLists.txt @@ -1,13 +1,16 @@ PROJECT(TDengine) IF (TD_LINUX) - AUX_SOURCE_DIRECTORY(. SRC) + # AUX_SOURCE_DIRECTORY(. SRC) ADD_EXECUTABLE(tcodbc main.c) TARGET_LINK_LIBRARIES(tcodbc odbc) + ADD_EXECUTABLE(tconv tconv.c) ENDIF () IF (TD_WINDOWS_64) - AUX_SOURCE_DIRECTORY(. SRC) + # AUX_SOURCE_DIRECTORY(. SRC) ADD_EXECUTABLE(tcodbc main.c) TARGET_LINK_LIBRARIES(tcodbc odbc32 odbccp32 user32 legacy_stdio_definitions os) + ADD_EXECUTABLE(tconv tconv.c) + TARGET_LINK_LIBRARIES(tconv os) ENDIF () diff --git a/src/connector/odbc/tests/main.c b/src/connector/odbc/tests/main.c index 74bceaaf3177737be4a6f8176a5372e8e356592b..c938bc9993009e4c5cc3c4b744e274a4c5254536 100644 --- a/src/connector/odbc/tests/main.c +++ b/src/connector/odbc/tests/main.c @@ -22,6 +22,17 @@ do { \ } \ } while (0); +typedef struct db_column_s db_column_t; +struct db_column_s { + char name[4096]; // seems enough + SQLSMALLINT nameLength; + SQLSMALLINT dataType; + SQLULEN columnSize; + SQLSMALLINT decimalDigits; + SQLSMALLINT nullable; +}; + +static db_column_t *columns = NULL; typedef struct data_s data_t; struct data_s { @@ -129,6 +140,30 @@ static int open_driver_connect(const char *connstr, SQLHENV *pEnv, SQLHDBC *pCon return 1; } + +static SQLRETURN traverse_cols(SQLHSTMT stmt, SQLSMALLINT cols) { + SQLRETURN r = SQL_ERROR; + for (SQLSMALLINT i=0; i