Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to get the database location from a sqlite3 object?

Tags:

c++

c

sqlite

I have a bunch of sqlite db's floating around in my app (dont ask) and I need to be able to get the file location of the dbs. Is there any way of doing this by using the sqlite3 object? (I.e. not having to store the path alongside the db when the db was created)

Bonus Question: If there are more than one db attached to the sqlite3 object, how do I get the others as well (they were ATTACHed)?

Thanks!

like image 420
chacham15 Avatar asked Dec 28 '11 18:12

chacham15


People also ask

How do I view a database in sqlite3?

Open a command prompt (cmd.exe) and 'cd' to the folder location of the SQL_SAFI. sqlite database file. run the command 'sqlite3' This should open the SQLite shell and present a screen similar to that below.

How fetch data from sqlite3 database in Python?

SQLite Python: Querying Data First, establish a connection to the SQLite database by creating a Connection object. Next, create a Cursor object using the cursor method of the Connection object. Then, execute a SELECT statement. After that, call the fetchall() method of the cursor object to fetch the data.


1 Answers

API function: sqlite3_db_filename

like image 51
chacham15 Avatar answered Oct 11 '22 19:10

chacham15