Subject Re: [IBO] Tables and their existance
Author Jason Wharton
> What is the best way (in a program using ib_connection) of finding
> whether a table exists and if so whether it is empty ?
> I do it by trying to read a record and if the table does not exist or
> is empty then of course there is an error. But this is clumsy, I
> would rather do a test of each.

Sounds Ok to me. You might consider using the
Connection.SchemaCache.TableNames list to check table existence. Easiest way
to tell if they are empty or not is to use a query with SELECT 1 FROM TABLE
and do a single record fetch and check for EOF. Do NOT do a SELECT
COUNT( * ) to tell if it is empty or not. Then you force the server to visit
every record in the table which is overkill.

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com