Question regarding modified ATTACH command

View: New views
4 Messages — Rating Filter:   Alert me  

Question regarding modified ATTACH command

by WClark-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: Question regarding modified ATTACH command

by WClark-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi again,

Sorry to trouble you all, but I was wondering whether anyone had some
insight into this question I asked earlier in the week.  I appreciate this
is a very busy forum and I didn't want this lost under a pile of other
topics!  ;o)  Any responses will be most gratefully received.

Alternatively, would sqlite-dev be a better forum to ask this sort of
question in?

Thanks
Will


> WClark@...
> Gesendet von: sqlite-users-bounces@...
>
> 03/11/2009 13:01
>
> [sqlite] Question regarding modified ATTACH command
>
> 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.  [This appears in the second posting]
>
> 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@...
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: Question regarding modified ATTACH command

by D. Richard Hipp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Nov 3, 2009, at 6:59 AM, WClark@... wrote:
>
> 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?


I don't see any obvious reason why your custom modification won't  
work.  But that doesn't mean I haven't overlooked something.

D. Richard Hipp
drh@...



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

Re: Question regarding modified ATTACH command

by WClark-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Richard,

Thank you for your reply.  At least if you don't think of an immediate
problem, then I have some assurance that its not going to cause huge
problems!

Either way, I will continue my own testing on it.

As a question, is it worth suggesting this as a general patch for sqlite,
or would it not have a more wider appeal?

Cheers
Will


> "D. Richard Hipp" <drh@...>
> 05/11/2009 16:50
>
> Re: [sqlite] Question regarding modified ATTACH command
>
> I don't see any obvious reason why your custom modification won't
> work.  But that doesn't mean I haven't overlooked something.
>
> D. Richard Hipp
> drh@...
>
_______________________________________________
sqlite-users mailing list
sqlite-users@...
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users