Skip to content

Commit

Permalink
Overriding the problem with c/c requires C99 with older GCC
Browse files Browse the repository at this point in the history
Fixing issue of lately added tests with old UnixODBC versions
  • Loading branch information
lawrinn committed Jun 10, 2023
1 parent fc52d66 commit 87072ef
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ SET(MARIADB_ODBC_VERSION_PATCH 19)
SET(MARIADB_ODBC_VERSION_QUALITY "ga")

SET(MARIADB_ODBC_VERSION "03.01.0019")
IF(CMAKE_VERSION VERSION_LESS "3.1")
IF(CMAKE_C_COMPILER_ID STREQUAL "GNU")
SET (CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-std=gnu99 ${CMAKE_C_FLAGS}")
ENDIF()
ELSE()
SET(CMAKE_C_STANDARD 99)
endif()

SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)

Expand Down
1 change: 1 addition & 0 deletions test/basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,7 @@ ODBC_TEST(t_bug44971)
OK_SIMPLE_STMT(Stmt, "DROP DATABASE IF EXISTS bug44971");
OK_SIMPLE_STMT(Stmt, "CREATE DATABASE bug44971");
CHECK_DBC_RC(Connection, SQLGetConnectAttr(Connection, SQL_ATTR_CURRENT_CATALOG, buffer, sizeof(buffer), &len));
CHECK_STMT_RC(Stmt, SQLFreeStmt(Stmt, SQL_CLOSE));
CHECK_DBC_RC(Connection, SQLSetConnectAttr(Connection, SQL_ATTR_CURRENT_CATALOG, "bug44971xxx", 8));
/* Restoring original schema back. This also covers ODBC-392. Somehow it always hits here, but not in the previous line */
CHECK_DBC_RC(Connection, SQLSetConnectAttr(Connection, SQL_ATTR_CURRENT_CATALOG, buffer, len));
Expand Down
3 changes: 2 additions & 1 deletion test/catalog2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1891,6 +1891,7 @@ ODBC_TEST(odbc391)
OK_SIMPLE_STMT(Stmt, "DROP SCHEMA IF EXISTS _SchemaOdbc391");
OK_SIMPLE_STMT(Stmt, "CREATE SCHEMA _SchemaOdbc391");
CHECK_DBC_RC(Connection, SQLGetConnectAttr(Connection, SQL_ATTR_CURRENT_CATALOG, buffer, sizeof(buffer), &len));
CHECK_STMT_RC(Stmt, SQLFreeStmt(Stmt, SQL_CLOSE));
CHECK_DBC_RC(Connection, SQLSetConnectAttr(Connection, SQL_ATTR_CURRENT_CATALOG, (SQLPOINTER)"_SchemaOdbc391", 14));
CHECK_STMT_RC(Stmt, SQLTables(Stmt, (SQLCHAR*)SQL_ALL_CATALOGS, 1, "", 0, "", 0, NULL, 0));
while (SQLFetch(Stmt) != SQL_NO_DATA)
Expand Down Expand Up @@ -1927,7 +1928,7 @@ ODBC_TEST(odbc391)
EXPECT_STMT(Stmt, SQLFetch(Stmt), SQL_NO_DATA);
CHECK_STMT_RC(Stmt, SQLFreeStmt(Stmt, SQL_CLOSE));

CHECK_STMT_RC(Stmt, SQLSpecialColumns(Stmt, SQL_ROWVER, dbname, (SQLSMALLINT)dbnameLen, NULL, SQL_NTS, tname, (SQLSMALLINT)tnameLen,
CHECK_STMT_RC(Stmt, SQLSpecialColumns(Stmt, SQL_ROWVER, dbname, (SQLSMALLINT)dbnameLen, NULL, 0, tname, (SQLSMALLINT)tnameLen,
SQL_SCOPE_TRANSACTION, SQL_NULLABLE));
CHECK_STMT_RC(Stmt, SQLFetch(Stmt));
EXPECT_STMT(Stmt, SQLFetch(Stmt), SQL_NO_DATA);
Expand Down

0 comments on commit 87072ef

Please sign in to comment.