Re: [sqlite] Re: bind with select?
On 10/23/06, Dave Dyer <[EMAIL PROTECTED]> wrote: You don't appear to be using BIND in the manner I was hoping for. You're using BIND to replace variables in the query. I want to use BIND (or something like it) eliminate the need for callback functions to consume the results of a select. Yes, you're correct. Bind is used to pass parameters to the executed sql not to retrieve the results. You must 'pull' all the results when you execute a query. Having sqlite 'push' them would only work if you have a single row as a result set or unless you provide it with a callback so it can tell you when a row is fully pushed. -- SqliteImporter and SqliteReplicator: Command line utilities for Sqlite http://www.reddawn.net/~jsprenkl/Sqlite Cthulhu Bucks! http://www.cthulhubucks.com - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Re: bind with select?
Dave Dyer wrote: You don't appear to be using BIND in the manner I was hoping for. You're using BIND to replace variables in the query. I want to use BIND (or something like it) eliminate the need for callback functions to consume the results of a select. -- At 05:42 PM 10/20/2006, Jay Sprenkle wrote: On 10/16/06, Dave Dyer <[EMAIL PROTECTED]> wrote: I can't find an example, but it seems like there ought to be syntax to use bind to inline selection variables, instead of having to have a callback function. Something like: char *forval,*barval; sqlite_prepare(db,"select ?foo,?bar from table"); sqlite_bind("?foo",&fooval); sqlite_bind("?bar",&balval); while () { sqlite_step() // foo and var bound to current values } can someone point me to an example, or good documentation? - To unsubscribe, send email to [EMAIL PROTECTED] - Dave, What you are looking for can't be done directly using the C API functions. As far as I know, the only language binding for SQLite that does what you are looking for directly is Richard's TCL binding. You can do the following using the C API functions. sqlite3_stmt* s; sqlite3_prepare(db,"select foo, bar from table", -1, s, NULL); while (sqlite_step(s) == SQLITE_ROW) { char* fooval = sqlite3_column_text(s, 1); char* barval = sqlite3_column_text(s, 2); // foo and var bound to current values } sqlite3_finalize(s); HTH Dennis Cote - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Re: bind with select?
Use sqlite3_step. Dave Dyer wrote: You don't appear to be using BIND in the manner I was hoping for. You're using BIND to replace variables in the query. I want to use BIND (or something like it) eliminate the need for callback functions to consume the results of a select. -- At 05:42 PM 10/20/2006, Jay Sprenkle wrote: On 10/16/06, Dave Dyer <[EMAIL PROTECTED]> wrote: I can't find an example, but it seems like there ought to be syntax to use bind to inline selection variables, instead of having to have a callback function. Something like: char *forval,*barval; sqlite_prepare(db,"select ?foo,?bar from table"); sqlite_bind("?foo",&fooval); sqlite_bind("?bar",&balval); while () { sqlite_step() // foo and var bound to current values } can someone point me to an example, or good documentation? - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Re: bind with select?
Dave Dyer <[EMAIL PROTECTED]> wrote: You don't appear to be using BIND in the manner I was hoping for. You're using BIND to replace variables in the query. I want to use BIND (or something like it) eliminate the need for callback functions to consume the results of a select. Use sqlite3_prepare, sqlite3_step, sqlite3_column_* to iterate over the resultset. You don't need any callbacks. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Re: bind with select?
You don't appear to be using BIND in the manner I was hoping for. You're using BIND to replace variables in the query. I want to use BIND (or something like it) eliminate the need for callback functions to consume the results of a select. -- At 05:42 PM 10/20/2006, Jay Sprenkle wrote: >On 10/16/06, Dave Dyer <[EMAIL PROTECTED]> wrote: >> >>I can't find an example, but it seems like there ought to be >>syntax to use bind to inline selection variables, instead of >>having to have a callback function. >> >>Something like: >> >> char *forval,*barval; >> sqlite_prepare(db,"select ?foo,?bar from table"); >> sqlite_bind("?foo",&fooval); >> sqlite_bind("?bar",&balval); >> >> while () { sqlite_step() >>// foo and var bound to current values >>} >> >>can someone point me to an example, or good documentation? - To unsubscribe, send email to [EMAIL PROTECTED] -