Skip to content

Commit 4e8f68d

Browse files
committed
Fixed in tests SQL staements there schemaname was not in quotes
Could cause failures with some schema names. Fixed one potentially wrong thing in the SQLGetTypeInfo data array initialization(in ma_info.cpp)
1 parent af97ea3 commit 4e8f68d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

driver/ma_info.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static mariadb::bytes_view zero("0", 2), one("1", 2), three("3", 2), Null, ten("
3333

3434
std::vector <std::vector<mariadb::bytes_view>> TypeInfoV3=
3535
{
36-
{bytes_view(XBV(BIT), 4), sqlbit, one, empty, empty, Null, one, one, three, zero, zero, zero, zero, zero, zero, zero, zero,
36+
{XBV(BIT), sqlbit, one, empty, empty, Null, one, one, three, zero, zero, zero, zero, zero, zero, zero, zero,
3737
ten, sqlbit},
3838
{XBV(BOOL), sqlbit,one,empty,empty,Null,one,one,three,zero,zero,zero,XBV(BOOL),zero,zero,zero,zero,ten, sqlbit},
3939
{XBV(TINYINT),sqltinyint,three,empty,empty,Null,one,zero,three,BV(XSTR(SQL_FALSE)),zero,one,XBV(TINYINT),zero,zero,zero,zero,

test/basic.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
3-
2013, 2024 MariaDB Corporation AB
3+
2013, 2025 MariaDB Corporation plc
44
55
The MySQL Connector/ODBC is licensed under the terms of the GPLv2
66
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -1582,14 +1582,14 @@ ODBC_TEST(t_odbc91)
15821582
IS_STR(buffer, "t_odbc91", sizeof("t_odbc91"));
15831583
/* Checking if selescting schema with USE is reflected by SQLGetConnectAttr.
15841584
Re-using conn_out buffer here, as it is > NAME_LEN + "USE " and harmless to reuse */
1585-
sprintf(conn_out, "USE %s", my_schema);
1585+
sprintf(conn_out, "USE `%s`", my_schema);
15861586
CHECK_DBC_RC(hdbc, SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt));
15871587
OK_SIMPLE_STMT(hstmt, conn_out);
15881588
CHECK_DBC_RC(hdbc, SQLGetConnectAttr(hdbc, SQL_ATTR_CURRENT_CATALOG, buffer, sizeof(buffer), NULL));
15891589
IS_STR(buffer, my_schema, strlen(my_schema));
15901590

15911591
/* No checking the same if changing schema is part ot a batch */
1592-
sprintf(conn_out, "USE t_odbc91;USE %s", my_schema);
1592+
sprintf(conn_out, "USE t_odbc91;USE `%s`", my_schema);
15931593
OK_SIMPLE_STMT(hstmt, conn_out);
15941594
/* Session tracked after result is read */
15951595
CHECK_STMT_RC(hstmt, SQLMoreResults(hstmt));

test/prepare.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
3-
2013, 2022 MariaDB Corporation AB
3+
2013, 2025 MariaDB Corporation plc
44
55
The MySQL Connector/ODBC is licensed under the terms of the GPLv2
66
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -1277,7 +1277,7 @@ ODBC_TEST(t_mdev16708)
12771277
{
12781278
skip("The test requires min 10.6.0 version");
12791279
}
1280-
_snprintf(query, sizeof(query), "USE %s", my_schema);
1280+
_snprintf(query, sizeof(query), "USE `%s`", my_schema);
12811281
CHECK_STMT_RC(Stmt, SQLPrepare(Stmt, query, SQL_NTS));
12821282
/* USE in particular won't support parameters */
12831283
/* CHECK_STMT_RC(Stmt, SQLBindParameter(Stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 0, 0, my_schema, strlen(dbname), NULL)); */

0 commit comments

Comments
 (0)