Luis Esteban Fajardo Bravo wrote:


my question is if there's a better solution for check if the database is already created, something like a "describe" SQL Command (in oracle) that help to know if the schema is already there on the database?


Luis,

You can use the pragma user_version command (see http://www.sqlite.org/pragma.html#version for detail). If you set the user version to some non-zero value when you initialize the database schema, then you can check for this condition as the first access of the database. In pseudo code you do this:

if (db_user_version == 0) {
   begin transaction
   initialize schema
   db_user_version = MY_VERSION;
   commit transaction
}

This will also allow you to check for and update older versions of your schema when you make changes.

HTH
Dennis Cote

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to