Skip to content

Commit

Permalink
fix: add LIKE only when table_name != NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
artpaul committed Aug 18, 2017
1 parent 52a6a50 commit 15c71db
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions driver/odbc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,11 +684,11 @@ SQLTables(HSTMT statement_handle,
" FROM system.tables"
" WHERE (1 == 1)";

if (catalog_name_length)
if (catalog_name && catalog_name_length)
query << " AND TABLE_CAT LIKE '" << stringFromSQLChar(catalog_name, catalog_name_length) << "'";
//if (schema_name_length)
// query << " AND TABLE_SCHEM LIKE '" << stringFromSQLChar(schema_name, schema_name_length) << "'";
if (table_name_length)
if (table_name && table_name_length)
query << " AND TABLE_NAME LIKE '" << stringFromSQLChar(table_name, table_name_length) << "'";
//if (table_type_length)
// query << " AND TABLE_TYPE = '" << stringFromSQLChar(table_type, table_type_length) << "'";
Expand Down

0 comments on commit 15c71db

Please sign in to comment.