mardi 1 mars 2016

How do I check if a SQLite database is attached or opened in read only mode?

I am using System.Data.SQlite to work with SQLite in C#.

I am attaching .db files to the connection using:

var q = string.Format(@"ATTACH DATABASE 'file:{0}?mode={2}' AS '{1}';", dbFileName, schemaName, mode);
conn.Execute(q);

How can I later find out in which mode (read, read/write, read/write/create) the database was attached using? Is there a system table, PRAGMA command or perhaps a C# function wrapping the sqlite3.sqlite3_db_readonly(D,N) function?

Thanks!

Aucun commentaire:

Enregistrer un commentaire