Tony Harris wrote:
Now my question is - since the open function will create a new file without
throwing back any error stating that a new file was created, I am now faced
with the problem of how do I check if a table is there or not? Do I just make
a call to create_table and if it throws back an error assume the table already
existed? Or is there a way within the api that I haven't found to test for
existance of tables?
Tony,
You can use the user_version value to check if you have initialized your
database or not.
Check the version after opening the database using:
pragma user_version;
If the value is zero the database hasn't been initialized, so create
your tables and then change the user version value in a transaction.
begin;
create table...
pragma user_version = 1;
commit;
If the user version is not zero, then you know that the database has
already been initialized and you can simply start using it.
HTH
Dennis Cote