Skip to content

Commit

Permalink
Merge pull request #206 from AlexNaraito/sqltables31
Browse files Browse the repository at this point in the history
Fix for ODBC-202. SQLTables error where table name is over 31 characters
  • Loading branch information
mariuz authored Nov 20, 2023
2 parents ac80d33 + 620e50d commit 60eb192
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions IscDbc/IscTablesResultSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ void IscTablesResultSet::getTables(const char * catalog, const char * schemaPatt
if (catalog && *catalog)
addString(pt, catalog);
addString(pt, "' as varchar(255)) as table_cat,\n" // 1
"cast (tbl.rdb$owner_name as varchar(31)) as table_schem,\n" // 2
"cast (tbl.rdb$relation_name as varchar(31)) as table_name,\n" // 3
"cast (tbl.rdb$owner_name as varchar(63)) as table_schem,\n" // 2
"cast (tbl.rdb$relation_name as varchar(63)) as table_name,\n" // 3
"cast ('TABLE' as varchar(13)) as table_type,\n" // 4
"cast (NULL as varchar(255)) as remarks,\n" // 5
"tbl.rdb$system_flag,\n" // 6
Expand All @@ -84,9 +84,9 @@ void IscTablesResultSet::getTables(const char * catalog, const char * schemaPatt
pt = ptSql;
addString(pt, "select cast( '");
addString(pt, metaData->getDSN());
addString(pt, "' as varchar(31)) as table_cat,\n" // 1
"cast (NULL as varchar(31)) as table_schem,\n" // 2
"cast (NULL as varchar(31)) as table_name,\n" // 3
addString(pt, "' as varchar(63)) as table_cat,\n" // 1
"cast (NULL as varchar(63)) as table_schem,\n" // 2
"cast (NULL as varchar(63)) as table_name,\n" // 3
"cast (NULL as varchar(13)) as table_type,\n" // 4
"cast (NULL as varchar(255)) as remarks\n" // 5
"from rdb$database tbl\n");
Expand All @@ -102,8 +102,8 @@ void IscTablesResultSet::getTables(const char * catalog, const char * schemaPatt
&& !(tableNamePattern && *tableNamePattern) )
{
ptSql = "select distinct cast (NULL as varchar(7)) as table_cat,\n" // 1
"cast (tbl.rdb$owner_name as varchar(31)) as table_schem,\n" // 2
"cast (NULL as varchar(31)) as table_name,\n" // 3
"cast (tbl.rdb$owner_name as varchar(63)) as table_schem,\n" // 2
"cast (NULL as varchar(63)) as table_name,\n" // 3
"cast (NULL as varchar(13)) as table_type,\n" // 4
"cast (NULL as varchar(255)) as remarks\n" // 5
"from rdb$relations tbl\n";
Expand All @@ -117,8 +117,8 @@ void IscTablesResultSet::getTables(const char * catalog, const char * schemaPatt
&& !(tableNamePattern && *tableNamePattern) )
{
ptSql = "select cast (NULL as varchar(7)) as table_cat,\n" // 1
"cast (NULL as varchar(31)) as table_schem,\n" // 2
"cast (NULL as varchar(31)) as table_name,\n" // 3
"cast (NULL as varchar(63)) as table_schem,\n" // 2
"cast (NULL as varchar(63)) as table_name,\n" // 3
"cast ('SYSTEM TABLE' as varchar(13)) as table_type,\n" // 4
"cast (NULL as varchar(255)) as remarks\n" // 5
"from rdb$database tbl\n";
Expand Down

0 comments on commit 60eb192

Please sign in to comment.