AlphaDAO - Listing Tables in a Database


When you use the .listTables() or .listTablesWithTypes() methods to list the tables in a database, by default, only the first 1,000 objects are listed.

As a result of this, many of the builders you use in AlphaAnywhere that require you to select a table only present a list showing the first 1000 tables in the database. Now, a new setting in the Settings dialog box allows you to set the maximum number of tables returned in a table listing. To open the Settings dialog box, select the top-level View menu, then select Settings.


If you are using AlphaDAO to get your own listing of tables in an object, the SQL::TableFilter object which is passed into the .listTables() and .listTablesWithTypes() method now allows you to set the .MaximumTablesInList property on the SQL::TableFilter object. Set this property to -1 for no limit. For example:

dim sqlFilter as sql::TableFilter
sqlFilter.IncludeAliases= .t.
sqlFilter.IncludeAllCatalogs= .F.
sqlFilter.IncludeAllOwners= .F.
sqlFilter.IncludeAllSchemas= .T.
sqlFilter.IncludeLinkedTables= .f.
sqlFilter.IncludeSynonyms= .t.
sqlFilter.IncludeSystemTables= .f.
sqlFilter.IncludeTables= .t.
sqlFilter.IncludeViews= .t.
sqlfilter.MaximumTablesInList = 2000
dim cn as sql::connection"::name::myconnection")
dim list as c 
list = cn.listTables(sqlFilter)
You can use the Xbasic helper function to list tables and automatically honor the setting you have defined in the Settings dialog. The helper functions are a5_list_tables() and a5_list_tables_with_types(). The functions take the connection object as the first parameter and the sql::tableFilter object as the second parameter.