>> P.S: I know that one can simply do a CREATE TABLE IF NOT EXISTS... but I >> still need to know if a table exists or not. > > You can easily try this with the sqlite3 command line tool by omitting > the database file name argument on the command line. > Create a table, insert a row, check sqlite_master.
When you omit database name on the command line you create a temporary on-disk database, just the same way as you provide an empty database name to sqlite3_open. To test in-memory database from sqlite3 command line tool you should use ":memory:" as a database name on the command line, just the same way as you do in sqlite3_open. Pavel On Thu, Nov 24, 2011 at 9:25 AM, Kees Nuyt <k.n...@zonnet.nl> wrote: > On Thu, 24 Nov 2011 08:45:12 -0500, Dilip Ranganathan > <misc.us...@gmail.com> wrote: > >> Currently I use sqlite to create a bunch of on-disk tables to store my >> data. I use Sqlite's master table to determine if a table already exists >> based on which I take certain decisions. >> >> Suppose I switch these to in-memory tables (:memory:), how do I go about >> checking if a table exists? Do in-memory tables still get an entry in the >> master table? > > Yes. > >> If not, how else should I go about with this? > > when you connect to the in-memory database you can be sure none of the > tables exist because an in memory database is not persistent. > >> thanks! >> >> P.S: I know that one can simply do a CREATE TABLE IF NOT EXISTS... but I >> still need to know if a table exists or not. > > You can easily try this with the sqlite3 command line tool by omitting > the database file name argument on the command line. > Create a table, insert a row, check sqlite_master. > > -- > Regards, > > Kees Nuyt > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users