Skip to content

Commit

Permalink
ODBC-150 The fix and extended old testcase. DESC
Browse files Browse the repository at this point in the history
statement caused error with the connector.
  • Loading branch information
lawrinn committed Jun 25, 2018
1 parent 7a1a226 commit 6afe9ee
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ma_parse.c
Expand Up @@ -252,6 +252,10 @@ enum enum_madb_query_type MADB_GetQueryType(const char *Token1, const char *Toke
return MADB_QUERY_SET;
}
}
if (_strnicmp(Token1, "DESC", 4) == 0)
{
return MADB_QUERY_DESCRIBE;
}
return MADB_QUERY_NO_RESULT;
}

Expand Down
3 changes: 2 additions & 1 deletion ma_parse.h
Expand Up @@ -37,7 +37,8 @@ enum enum_madb_query_type { MADB_QUERY_NO_RESULT= 0, /* Default type for the que
MADB_QUERY_ANALYZE,
MADB_QUERY_EXPLAIN,
MADB_QUERY_CHECK,
MADB_QUERY_EXECUTE
MADB_QUERY_EXECUTE,
MADB_QUERY_DESCRIBE
};

typedef struct {
Expand Down
11 changes: 9 additions & 2 deletions test/result2.c
@@ -1,6 +1,6 @@
/*
Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
2013, 2016 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 @@ -1047,6 +1047,7 @@ ODBC_TEST(t_odbc58)
}


/* Also contains test for ODBC-150(same problem with DESCRIBE statement) */
ODBC_TEST(t_odbc77)
{
OK_SIMPLE_STMT(Stmt, "ANALYZE TABLE non_existent");
Expand Down Expand Up @@ -1079,7 +1080,13 @@ ODBC_TEST(t_odbc77)
OK_SIMPLE_STMT(Stmt, "DROP TABLE IF EXISTS odbc77");
OK_SIMPLE_STMT(Stmt, "CREATE TABLE odbc77(id INT NOT NULL)");
OK_SIMPLE_STMT(Stmt, "TRUNCATE TABLE odbc77");
OK_SIMPLE_STMT(Stmt, "DESC odbc77");
/* odbc-150*/
my_print_non_format_result(Stmt);
OK_SIMPLE_STMT(Stmt, "DESCRIBE odbc77");
my_print_non_format_result(Stmt);
OK_SIMPLE_STMT(Stmt, "DROP TABLE odbc77");
CHECK_STMT_RC(Stmt, SQLFreeStmt(Stmt, SQL_CLOSE));

OK_SIMPLE_STMT(Stmt, "SELECT 1");
CHECK_STMT_RC(Stmt, SQLFetch(Stmt));
Expand Down Expand Up @@ -1301,7 +1308,7 @@ MA_ODBC_TESTS my_tests[]=
{t_odbc29, "t_odbc-29"},
{t_odbc41, "t_odbc-41-nors_after_rs"},
{t_odbc58, "t_odbc-58-numeric_after_blob"},
{t_odbc77, "t_odbc-77-analyze_table"},
{t_odbc77, "t_odbc-77_150-analyze_table_desc_table"},
{t_odbc78, "t_odbc-78-sql_no_data"},
{t_odbc73, "t_odbc-73-bin_collation"},
{t_odbc134, "t_odbc-134-fetch_unbound_null"},
Expand Down

0 comments on commit 6afe9ee

Please sign in to comment.