[freetds] SQLTables and wildcards (was Squirrel JDBC-ODBC Bridge and freeTDS ODBC)

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Wed Nov 2 06:13:50 EST 2005


Well, I go a bit deeper on this issue. Calling ODBC SQLTables using odbc
3 catalog parameter can contains wildcards (%, _). What does this mean
and what's the problem? Current implementation simply calls sp_tables
however sp_tables do not accept wildcards on @table_qualifier parameter
(it only accept same name of database). mssql (2000 or 7 I don't know)
introduced a new sp_tableswc (sp_tables wildcard I think) that accept
wildcards on catalog (catalog, qualifier and database name are the same
things here). It simply execute a sp_tables for every database it find
from master..sysdatabases, collect results in a temporary table and then
return this table. The problem now is how to implement this sp_tableswc
on Sybase (which do not provide it). Declaring cursor to get database
names is not a problem however I'm not able to collect data returned
from a store procedure.... mssql support a 

  insert into <table_name> exec sp_tables ...

syntax however Sybase reject it. If anyone have some hints... there are
some solution:
- compute a big query on client side to get all information
- execute a "select name from master..sysdatabase where ...", build a
list of "database..sp_tables ..." query, cache on client and join
results to client
- use a sort of way to execute a query just after another query not
going to idle state to join multiple sp_tables results, similar to
previous but without the need to cache all results

freddy77



More information about the FreeTDS mailing list