Skip to content

Commit

Permalink
Addition to the fix of ODBC-123 and the testcase for that problem - f…
Browse files Browse the repository at this point in the history
…or SQL_CATALOG_LOCATION info type the connector incorrectly wrote to the buffer SQLUINTEGER, while it has to be SQLUSMALLINT
  • Loading branch information
Lawrin authored and lawrinn committed Jan 13, 2018
1 parent a22bf42 commit 4f8bdb9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ma_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ SQLRETURN MADB_DbcGetInfo(MADB_Dbc *Dbc, SQLUSMALLINT InfoType, SQLPOINTER InfoV
MADB_SET_NUM_VAL(SQLUINTEGER, InfoValuePtr, 0, StringLengthPtr);
break;
case SQL_CATALOG_LOCATION:
MADB_SET_NUM_VAL(SQLUINTEGER, InfoValuePtr, SQL_CL_START, StringLengthPtr);
MADB_SET_NUM_VAL(SQLUSMALLINT, InfoValuePtr, SQL_CL_START, StringLengthPtr);
break;
case SQL_CATALOG_NAME:
/* Todo: MyODBC Driver has a DSN configuration for diabling catalog usage:
Expand Down
16 changes: 15 additions & 1 deletion test/info.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
2013, 2017 MariaDB Corporation AB
2013, 2018 MariaDB Corporation AB
The MySQL Connector/ODBC is licensed under the terms of the GPLv2
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
Expand Down Expand Up @@ -659,6 +659,19 @@ ODBC_TEST(t_odbc71)
}


/* Test for SQL_CATALOG_LOCATION info type. The connector incorrectly wrote to the buffer SQLUINTEGER,
while it has to be SQLUSMALLINT */
ODBC_TEST(t_odbc123)
{
SQLUSMALLINT Info;

CHECK_DBC_RC(Connection, SQLGetInfo(Connection, SQL_CATALOG_LOCATION, &Info, 0, NULL));
is_num(Info, SQL_CL_START);

return OK;
}


MA_ODBC_TESTS my_tests[]=
{
{ t_gettypeinfo, "t_gettypeinfo", NORMAL },
Expand All @@ -678,6 +691,7 @@ MA_ODBC_TESTS my_tests[]=
{ t_odbc61, "odbc61_SQL_FILE_USAGE", NORMAL },
{ t_odbc84_62, "odbc84_WCHAR_types_odbc62_CREATE_PARAMS", NORMAL },
{ t_odbc71, "odbc71_some_odbc2_types", NORMAL },
{ t_odbc123, "odbc123_catalog_start", NORMAL },
{ NULL, NULL }
};

Expand Down

0 comments on commit 4f8bdb9

Please sign in to comment.