diff --git a/CMakeLists.txt b/CMakeLists.txt index 6cb5e9db..a54121a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ if(ODBC_FOUND) if(WIN32) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) -# add_subdirectory(winsetup) + add_subdirectory(winsetup) list(APPEND LINK_LIB_LIST $<$:odbccp32>) list(APPEND LINK_LIB_LIST $<$:legacy_stdio_definitions>) diff --git a/src/prepared.cpp b/src/prepared.cpp index 036b8424..0ceb72c3 100644 --- a/src/prepared.cpp +++ b/src/prepared.cpp @@ -86,7 +86,7 @@ SQLRETURN SQL_API SQLNumParams(SQLHSTMT statement_handle, SQLSMALLINT *parameter if (!parameter_count_ptr) { return SQL_ERROR; } - *parameter_count_ptr = (SQLSMALLINT)hstmt->stmt->n_param; + *parameter_count_ptr = (SQLSMALLINT)hstmt->stmt->named_param_map.size(); return SQL_SUCCESS; } @@ -139,7 +139,7 @@ SQLRETURN SQL_API SQLDescribeParam(SQLHSTMT statement_handle, SQLUSMALLINT param return ret; } - if (parameter_number <= 0 || parameter_number > hstmt->stmt->n_param) { + if (parameter_number <= 0 || parameter_number > hstmt->stmt->named_param_map.size()) { return SQL_ERROR; } // TODO make global maps with type mappings for duckdb <> odbc diff --git a/src/statement/statement_functions.cpp b/src/statement/statement_functions.cpp index 71ef1286..de170631 100644 --- a/src/statement/statement_functions.cpp +++ b/src/statement/statement_functions.cpp @@ -66,7 +66,7 @@ SQLRETURN duckdb::FinalizeStmt(duckdb::OdbcHandleStmt *hstmt) { SQLStateType::ST_42000, hstmt->dbc->GetDataSourceName())); } - hstmt->param_desc->ResetParams(hstmt->stmt->n_param); + hstmt->param_desc->ResetParams(hstmt->stmt->named_param_map.size()); hstmt->bound_cols.resize(hstmt->stmt->ColumnCount()); diff --git a/test/isql-test.py b/test/isql-test.py index 5d551b61..f5db7d9a 100644 --- a/test/isql-test.py +++ b/test/isql-test.py @@ -184,8 +184,8 @@ def test(cmd, out=None, err=None, extra_commands=None, input_file=None): test("SELECT ' '::TIME", err="[ISQL]ERROR") test("SELECT '1'::TIME", err="[ISQL]ERROR") test("SELECT '11'::TIME", err="[ISQL]ERROR") -test("SELECT '11:'::TIME", err="[ISQL]ERROR") -test("SELECT '11:11'::TIME", err="[ISQL]ERROR") +test("SELECT '11:'::TIME", out="11:00:00") +test("SELECT '11:11'::TIME", out="11:11:00") test("SELECT '11:11:f'::TIME", err="[ISQL]ERROR") ### FROM test/sql/types/time/test_time.test ################################# diff --git a/test/tests/catalog_functions.cpp b/test/tests/catalog_functions.cpp index 424928da..1c32f87c 100644 --- a/test/tests/catalog_functions.cpp +++ b/test/tests/catalog_functions.cpp @@ -197,12 +197,12 @@ static void TestSQLTablesSchema(HSTMT &hstmt) { DATA_CHECK(hstmt, 4, "TABLE"); // No schema name should give all tables, including main schema - EXECUTE_AND_CHECK("SQLTables", SQLTables, hstmt, nullptr, 0, ConvertToSQLCHAR(""), SQL_NTS, - ConvertToSQLCHAR("%"), SQL_NTS, ConvertToSQLCHAR("TABLE"), SQL_NTS); + EXECUTE_AND_CHECK("SQLTables", SQLTables, hstmt, nullptr, 0, ConvertToSQLCHAR(""), SQL_NTS, ConvertToSQLCHAR("%"), + SQL_NTS, ConvertToSQLCHAR("TABLE"), SQL_NTS); - std::vector> expected_data = { - {"test_table_2", "ducks"}, {"bool_table", "main"}, {"bytea_table", "main"}, - {"interval_table", "main"}, {"lo_test_table", "main"}, {"test_table_1", "main"}}; + std::vector> expected_data = {{"test_table_2", "ducks"}, {"bool_table", "main"}, + {"bytea_table", "main"}, {"interval_table", "main"}, + {"lo_test_table", "main"}, {"test_table_1", "main"}}; for (int i = 0; i < expected_data.size(); i++) { SQLRETURN ret = SQLFetch(hstmt); diff --git a/test/tests/select.cpp b/test/tests/select.cpp index 2c2e2468..73c93c84 100644 --- a/test/tests/select.cpp +++ b/test/tests/select.cpp @@ -14,7 +14,7 @@ TEST_CASE("Test Select Statement", "[odbc]") { // Allocate a statement handle EXECUTE_AND_CHECK("SQLAllocHandle (HSTMT)", SQLAllocHandle, SQL_HANDLE_STMT, dbc, &hstmt); - // Execute a simple query + // Execute a simple query EXECUTE_AND_CHECK("SQLExecDirect (SELECT 1 UNION ALL SELECT 2)", SQLExecDirect, hstmt, ConvertToSQLCHAR("SELECT 1 UNION ALL SELECT 2"), SQL_NTS);