Each SQLite database has its own sqlite_master table.  If open the :memory:
database its sqlite_master table can be accessed as sqlite_master or
main.sqlite_master.  If you attach it, say, using:

Attach database ':memory:' as memory;

Then the :memory: database's sqlite_master be accessed with the same you
assigned it.  For the example above, for instance:

Select tbl_name from memory.sqlite_master where tbl_name = 'mytable';

Best regards,

Peter

> -----Original Message-----
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
> boun...@sqlite.org] On Behalf Of Dilip Ranganathan
> Sent: Thursday, November 24, 2011 6:45 AM
> To: sqlite-users@sqlite.org
> Subject: [sqlite] Checking for existence of in-memory tables
> 
> 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? If not, how else should I go about with this?
> 
> 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.
> _______________________________________________
> 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

Reply via email to