Re: [sqlite] sqlite2 api question - updates

2006-05-16 Thread Jay Sprenkle
> I couldn't get parameters to work at all. I assume they're just not implemented > in 2.x sqlite. Prepared statements are implemented in SQLite 2.8.x. See sqlite.h for exact API and how to use it. Its very similar to SQLite3 API. Something along the lines of sqlite_compile/sqlite_bind/sqlite_ste

Re: [sqlite] sqlite2 api question - updates

2006-05-16 Thread Nemanja Corlija
On 5/16/06, Jay Sprenkle <[EMAIL PROTECTED]> wrote: I couldn't get parameters to work at all. I assume they're just not implemented in 2.x sqlite. Prepared statements are implemented in SQLite 2.8.x. See sqlite.h for exact API and how to use it. Its very similar to SQLite3 API. Something along t

Re: [sqlite] sqlite2 api question - updates

2006-05-16 Thread Jay Sprenkle
On 5/16/06, Craig Morrison <[EMAIL PROTECTED]> wrote: All it does is slurp input, concatenate it into one long string and then feed it to sqlite_exec(..). So it seems in theory the normal escaping mechanisms should work. It must be operator head space on my part... Thanks for looking though

Re: [sqlite] sqlite2 api question - updates

2006-05-16 Thread Craig Morrison
Jay Sprenkle wrote: > If version 2 does not support parameters what's the correct way to escape > the data? > I don't know about parameters, but here is one way: char *pszStatement; #define STATEMENT "UPDATE question SET qtext = '%q' WHERE qnumber=%d;" pszStatement = sqlite_mprintf(STATEMENT,

Re: [sqlite] sqlite2 api question - updates

2006-05-16 Thread Jay Sprenkle
On 5/16/06, Craig Morrison <[EMAIL PROTECTED]> wrote: Jay Sprenkle wrote: > I'm trying to write a program using sqlite2.8. > > I've tried using the following sql from the command line tool and it > does not escape > the data correctly: >update question set qtext = 'this shouldn''t fail' where

Re: [sqlite] sqlite2 api question - updates

2006-05-16 Thread Craig Morrison
Jay Sprenkle wrote: I'm trying to write a program using sqlite2.8. I've tried using the following sql from the command line tool and it does not escape the data correctly: update question set qtext = 'this shouldn''t fail' where qnumber=1; The escaped single quote is replaced by garbage. I'v

[sqlite] sqlite2 api question - updates

2006-05-16 Thread Jay Sprenkle
I'm trying to write a program using sqlite2.8. I've tried using the following sql from the command line tool and it does not escape the data correctly: update question set qtext = 'this shouldn''t fail' where qnumber=1; The escaped single quote is replaced by garbage. I've tried writing a c p