SQL does-table-exist? (was Re: [V4RB] SQL "Create Table")

Erik Mueller-Harder lists at praxisworks.com
Tue Mar 11 17:07:45 CST 2003


On Tuesday, March 11, 2003, Ruslan Zasukhin wrote:

>> Ruslan, you say "This is not safe and good way."  Is it not OK to
>> perform inquiries on the system tables?
> 
> This is not very well tested.
> 
> So be careful. For example in 1.9.7 was fixed bug on access to sys
> tables.

You're quite right.

If I create a new database, and then check to see whether it contains a certain table (by looking at the SysItem table), and then create the missing table -- nothing happens.  No errors, and no new table.  (Running the same code on a pre-existing empty database with no tables works just fine, however.)

If I use the *exact* same code with no changes at all, other than following your and Fred Stephenson's suggestion of checking for the existence of the table using the baseObject property of the database, the table is created perfectly.  (Running this code on a pre-existing empty database with no tables also works just fine.)

I'd hoped to do everything via SQL so that I could use a textual log of SQL commands to (1) synchronize data among multiple users, (2) propagate database upgrades automatically among users, and (3) facilitate database recoveries.  Looks like we're not quite ready for this yet, at least not for work with the database structure itself.

Thanks, everyone, for your help.

Erik


More information about the Valentina mailing list