Hello,

I have a question regarding a modification I've made to the ATTACH 
DATABASE command in Sqlite.  The attached diff file (set against version 
3.6.17) shows the modifications I've made, which I hope can be read quite 
simply.

The modification involves adding an optional "READONLY" keyword; for 
example ATTACH READONLY DATABASE "file.db" AS db, which as it would imply 
attaches the database "read-only" rather than using the open flags used 
when opening the initial database.  It does this by simply clearing the 
SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE flags and setting 
SQLITE_OPEN_READONLY if the READONLY keyword is used in the ATTACH 
command.  If the initial database was opened read-only, then the READONLY 
keyword has no effect.

The modification as it stands "seems" to work - by which I mean that the 
test suite that is part of the Sqlite code still all passes, and my 
rudimentary testing also passes.  However, as a question to those much 
more knowledgeable in the internal workings of Sqlite, is this a valid 
thing to do?  Or have I overlooked something that will cause it to fail 
somewhere down the line?

Or... is there an altogether better way, and I should have just read the 
website more carefully?!?

Many thanks!

Will

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to