Re: EDS:: select or create table
- Posted by DerekParnell (admin) Feb 11, 2012
- 1455 views
BINGO! When I run the first block of code without evaluating dbtblst for atom status on a new db which has no table, I get a "true false condition must be an atom" for the line:
if dbtblst = NO_TABLE then
Shouldn't NO_Table be an atom?
NO_TABLE is an atom. However, according to the documentation, db_table_list() returns a sequence that contains a list of table names. If this sequence is empty, there are no tables in the database.
The NO_TABLE error code is returned only by those functions that can take a table name as a parameter and the supplied table name is not known in the current database. The db_table_list() function does not accept a table name as a parameter so it does not return NO_TABLE. Also, as a database can legally contain no tables, it is never an error condition for db_table_list() to return an empty list. The NO_TABLE is an error condition so its not appropriate for db_table_list() to return that code.