Re: [sqlite] sqlite database handle caching and write permissions

2010-07-16 Thread Dan Kennedy
On Jul 16, 2010, at 2:05 PM, JT Olds wrote: >> Unsafe. Using the authorizer callback instead to figure out if a >> statement may write the database is a better way: >> >> http://www.sqlite.org/c3ref/c_alter_table.html >> http://www.sqlite.org/c3ref/set_authorizer.html > > Beautiful Dan, thank

Re: [sqlite] sqlite database handle caching and write permissions

2010-07-16 Thread JT Olds
> Unsafe. Using the authorizer callback instead to figure out if a > statement may write the database is a better way: > >   http://www.sqlite.org/c3ref/c_alter_table.html >   http://www.sqlite.org/c3ref/set_authorizer.html Beautiful Dan, thank you. That problem I think has been nailed. Any ideas

Re: [sqlite] sqlite database handle caching and write permissions

2010-07-15 Thread Dan Kennedy
On Jul 16, 2010, at 6:33 AM, JT Olds wrote: > I really would rather not depend on what is in the SQL itself, as the > concern I have has nothing to do with whether or not the user runs > SELECT, but whether or not this will cause the library to write to > disk. I'd love to decouple those two thin

Re: [sqlite] sqlite database handle caching and write permissions

2010-07-15 Thread JT Olds
I really would rather not depend on what is in the SQL itself, as the concern I have has nothing to do with whether or not the user runs SELECT, but whether or not this will cause the library to write to disk. I'd love to decouple those two things. To that end, from an API perspective, is it safe

Re: [sqlite] sqlite database handle caching and write permissions

2010-07-15 Thread Jim Morris
You also need to watch for multiple command separated via ';' On 7/15/2010 11:36 AM, JT Olds wrote: > I considered that also, but I wasn't sure about whether or not that > guaranteed no disk writes (maybe some sort of function call might be > made there). That also restricts things like the usage

Re: [sqlite] sqlite database handle caching and write permissions

2010-07-15 Thread JT Olds
I considered that also, but I wasn't sure about whether or not that guaranteed no disk writes (maybe some sort of function call might be made there). That also restricts things like the usage of in-memory temp tables that might be useful. It appears that sqlite knows whether or not a statement will

Re: [sqlite] sqlite database handle caching and write permissions

2010-07-15 Thread Simon Slavin
On 15 Jul 2010, at 7:07pm, JT Olds wrote: > is there a way to check a prepared statement > before allowing its use as to if it will attempt to write to disk? You could perhaps accept only statements that start with 'SELECT'. It depends on how you're passing them to SQLite. Simon.

[sqlite] sqlite database handle caching and write permissions

2010-07-15 Thread JT Olds
Hello all, I have two slightly related questions regarding sqlite database handles. First, I'm developing a system that opens thousands of different sqlite databases at a variety of times, some database handles more often than others, but never the same one multiple times concurrently, though som