Simon,
Thanks for that. Just shows how new I am at SQL.

Thursday, February 21, 2008, 9:01:22 PM, you wrote:

SD> See "IF NOT EXISTS" in http://www.sqlite.org/lang_createtable.html

SD> Rgds,
SD> Simon

SD> On 21/02/2008, Neville Franks <[EMAIL PROTECTED]> wrote:
>> I need to create tables on the fly which will persist across sessions.
>> These tables may or may not already exist.
>>
>> Calling sqlite3_exec( "create table ..." ) for a table which already
>> exists returns SQLITE_ERROR, which I assume can be returned for a range
>> of different errors. You can check the szError string to determine the
>> precise error, but this will fall down if the error text is ever
>> changed, so I'm reluctant to do this. Further it doesn't seem right to
>> try and create a table that already exists.
>>
>> So my solution is do do a query:
>>  select name, from sqlite_master where type='table' and name=table_name;
>> and check the result before attempting to create the table.
>>
>> My question is what do other folks do here? Is my solution a good one?
>>
>> --
>> Best regards,
>>  Neville Franks, http://www.surfulater.com http://blog.surfulater.com
>>
>>
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>



-- 
Best regards,
  Neville Franks, http://www.surfulater.com http://blog.surfulater.com
 

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

Reply via email to