On 11 Aug 2009, at 4:50pm, Radcon Entec wrote:

> At startup, the application creates three tables.  If the file  
> previously existed, the create table queries fail.  My code checks  
> the error message, and if it indicates that the table previously  
> existed, it ignores the error.

Use the 'IF NOT EXISTS' form:

CREATE TABLE IF NOT EXISTS myTable ...

That way you don't need to have your own code to filter out just that  
one error.

> There is a fourth table that is handled differently.  This table  
> will be created at startup, used, and then dropped.  So, my code  
> drops the table, then creates it, and then adds data to it.  (The  
> final drop is not yet implemented.)  Just in case the table got left  
> behind for some reason, my code drops the table before creating it.   
> Any errors from the drop are ignored, although there is an exception  
> handler there and I have verified that the hander is not being  
> executed.


As a temporary fix to explore your problem, try executing the same  
commands in the command-line tool and see if it gives you any error  
messages.

As a permanent fix I assume you want this table to be blank.  So the  
best/fastest thing to do would be to drop the table if it exists, then  
always create a new one with that name.  Use the form of 'DROP TABLE'  
which includes 'IF EXISTS':

DROP TABLE IF EXISTS fourthTable;
CREATE TABLE fourthTable ...

This gives you two commands which should both always execute without  
errors.  That means you can implement proper error-trapping and pay  
attention to the errors instead of ignoring them.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to