Re: EDS:: NO_TABLE, db_table_list()

new topic     » goto parent     » topic index » view thread      » older message » newer message
DerekParnell said...
K_D_R said...

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 documentation currently makes no reference to an empty sequence. I believe the documentation should be improved by appending your last sentence above to the description of what db_table_list() returns:

Returns: 
A sequence, of all the table names in the current database. Each element of  
this sequence is a sequence, the name of a table. If this sequence is empty, 
there are no tables in the database. 

DerekParnell said...

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.

I somehow miss the above information in the documentation. Given the current state of the documentation search facilities, it could be there and easily missed. What I do see is this:

8.28.3.4 NO_TABLE 
include std/eds.e 
namespace eds 
public enum NO_TABLE 
no table was found. 

No table was found. Certainly, no table was found by db_table_list() when the current db had no tables. Shouldn't that statement be replaced by a more accurate description, such as Derek has provided above?:

8.28.3.4 NO_TABLE 
include std/eds.e 
namespace eds 
public enum NO_TABLE 
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. 

DerekParnell said...

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.

Following that logic: as a database can legally not have a specific table sought by a certain function, it would not be an error to return an empty sequence, but an error code is returned instead.

A database can legally contain no tables and it can legally contain no tables with a name specified in the parameters of a function.

Isn't it is just as much of an error not to find any table at all in response to a query for a list of tables as it is not to find a specific table in response to a query for a table with a particular name? If there is a benefit in returning the NO_TABLE error code in the latter case, shouldn't that benefit be extended to the former case?



Jiri Babor did not suffer fools gladly. He commented a block of code in one of his programs:

-- in case of idiots 

I smiled, knowing Jiri was looking out for me.

Regards, Kenneth Rhodes

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu