Re: EDS:: NO_TABLE, db_table_list()
- Posted by DerekParnell (admin) Feb 11, 2012
- 1457 views
The documentation currently makes no reference to an empty sequence.
That is true. However I didn't think it would have to as an empty sequence is a list of all the tables in a database that contains no tables. I thought it was self evident as in ... 2 entries means there are 2 tables, 1 entry means that there is one table and zero entries therefore naturally means that there are no tables.
However, for Jiri's sake, I'll add this to the documentation.
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?:
The NO_TABLE value should more accurately be described as the specifically requested table was not found.
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?
I'm not sure that I agree with this logic. Asking for a list of all tables contained within a database and receiving a list with nothing in it is simply NOT an error condition. But, for example, asking to delete a record from a specific table and that table not existing IS an error condition. I say this because the first function can complete its requested task (listing all known tables), and the second cannot complete its task.