I am using sqlite to store my data. I have two databases. In my application, each time a new request comes, I am attaching first db to second db. The problem is, if two request come it is showing the db already in use (it is trying to attach twice with same alias name 'db'). I want to know if there is any way to check whether a database is attached or not?
PRAGMA database_list;
outputs a resultset with full list of available databases. The first column is database name, the second is database file (empty if it is not associated with file). The primary database is always named main
, temporary db is always temp
.
sqlite> attach "foo.db" as foo;
sqlite> pragma database_list;
0|main|
2|foo|/Users/me/tmp/foo.db
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With