[sqlite] Multiple prepared queries

2007-02-11 Thread Wesley W. Terpstra
Good evening. I've been working on an SQLite3 binding for Standard ML (SML) targeting the MLton compiler. I've read all the material on the C API I've found, but I have some questions about the VM prepare/step methods. Specifically, I am confused about the lifetime of non- finalized queries. It

Re: [sqlite] Multiple prepared queries

2007-02-12 Thread Wesley W. Terpstra
Thanks for your answers! On Feb 12, 2007, at 1:58 AM, [EMAIL PROTECTED] wrote: "Wesley W. Terpstra" <[EMAIL PROTECTED]> wrote: Suppose you have two prepared queries: q1 and q2. I currently believe that it is an error to execute: step q1, step q2, step q1. No. Queries ca

Re: [sqlite] Multiple prepared queries

2007-02-12 Thread Wesley W. Terpstra
On Feb 12, 2007, at 1:21 AM, John Stanton wrote: Prepared queries are actually the query compiled into the metalanguage, VDBE. You can have many statements in one transaction, and each of those statements can be reusing a VDBE virtual machine instance with a current set of data bound to

Re: [sqlite] Multiple prepared queries

2007-02-12 Thread Wesley W. Terpstra
On Feb 12, 2007, at 3:22 PM, John Stanton wrote: Look at how Sqlite implements callbacks in sqlite3_exec to discover a way to implement your language. I had already looked at it. I will be using the prepare_v2/bind/step/ reset/.../finalize interface instead. The exec interface is too

Re: [sqlite] Multiple prepared queries

2007-02-12 Thread Wesley W. Terpstra
On Feb 12, 2007, at 7:32 PM, John Stanton wrote: I suggest that you also look carefully at the manifest typing implemented in Sqlite. If your language is strongly typed you will have some design issues to address. I am aware of this issue and already have a solution. It's part of why I

Re: [sqlite] Multiple prepared queries

2007-02-12 Thread Wesley W. Terpstra
For anyone who has the same questions I had, I've found most of the answers. PS. Excellent internal documentation of the VDBE (though a bit out-of- date)! It made it really easy to navigate the source. On Feb 12, 2007, at 1:51 PM, Wesley W. Terpstra wrote: What is the defined behaviour

[sqlite] Patch: sqlite3_query_string

2007-02-14 Thread Wesley W. Terpstra
Please consider applying the attached patch to SQLite3. It adds support for a method sqlite3_query_string(sqlite3_stmt*); This is helpful for error reporting when query execution fails. It's also helpful if an application needs to clone an existing query. It is the logical analogue of

Re: [sqlite] Patch: sqlite3_query_string

2007-02-14 Thread Wesley W. Terpstra
On Feb 14, 2007, at 4:29 PM, Wesley W. Terpstra wrote: Please consider applying the attached patch It seems this mailing list strips file attachments. The patch is now available at <http://terpstra.ca/sqlite3_query_string.patch> As it's so short, you probably don't need a cop

[sqlite] Triggers+callbacks = GUI?

2007-02-15 Thread Wesley W. Terpstra
I intend to write a GUI application backed by SQL. Several of the windows display status that would best be represented as a database view. What I've been thinking about is how to update the GUI when the view changes. First the obvious approach: polling. Every X seconds re-execute the

Re: [sqlite] Triggers+callbacks = GUI?

2007-02-15 Thread Wesley W. Terpstra
On Feb 15, 2007, at 3:46 PM, Michael Schlenker wrote: Wesley W. Terpstra schrieb: I intend to write a GUI application backed by SQL. Several of the windows display status that would best be represented as a database view. What I've been thinking about is how to update the GUI when the view

Re: [sqlite] Triggers+callbacks = GUI?

2007-02-15 Thread Wesley W. Terpstra
On Feb 15, 2007, at 4:01 PM, [EMAIL PROTECTED] wrote: "Wesley W. Terpstra" <[EMAIL PROTECTED]> wrote: The approach I'd much prefer is to register a trigger to update the GUI... Note that the trigger runs on the client-side of the process that makes the change - not on

[sqlite] Bug: sqlite3_finalize in authorizer breaks step of another query

2007-02-17 Thread Wesley W. Terpstra
Compile the attached C program and run it in a directory with the attached test.db. kiwiw:~/sqlite3/x terpstra$ ls -l bug.c test.db -rw-r--r--1 terpstra terpstra 976 Feb 18 00:09 bug.c -rw-r--r--1 terpstra terpstra 6144 Feb 18 00:09 test.db kiwiw:~/sqlite3/x terpstra$ gcc -Wall

[sqlite] Announcing SQLite3/SML binding v0.1

2007-02-17 Thread Wesley W. Terpstra
I've finished writing a binding for SQLite3 to SML. It can be found at http://terpstra.ca/sqlite3-sml/sqlite3-sml-0.1.tar.gz svn://mlton.org/mltonlib/trunk/ca/terpstra/sqlite3-sml It covers the entire non-experimental SQLite3 interface and I find it convenient to use. I've put the glue

Re: [sqlite] BLOB question

2007-02-23 Thread Wesley W. Terpstra
A couple of comments. On Feb 23, 2007, at 3:03 PM, Cesar Rodas wrote: while ( (n=fread(buff,Buffsize,1,file)) > 0) { if (i>0) *value = realloc(*value, (i+1) * Buffsize); memcpy(*value + (i * Buffsize), buff, Buffsize); *len += n; i++; } You are