[sqlite] Multiple Prepared Statements

2015-05-09 Thread Kees Nuyt
On Fri, 08 May 2015 14:49:54 -0700, Scott Doctor wrote: > Can I prepare multiple statements then implement them in > arbitrary order (based on some logic)? Yes. > Or do the statements need to be prepared, stepped, finalized > serially? No. You even don't have to _finalize() the statement,

[sqlite] Multiple Prepared Statements

2015-05-09 Thread Simon Slavin
On 8 May 2015, at 11:40pm, Scott Doctor wrote: > So if I have a loop that finds a row with some data (statement1) > then based on values from that row sets fields in other rows > statement2 find a row to set new data > statement3 set column to something, > repeat n times. > then go back and do

[sqlite] Multiple Prepared Statements

2015-05-08 Thread Richard Hipp
On 5/8/15, Scott Doctor wrote: > > Can I prepare multiple statements then implement them in > arbitrary order (based on some logic)? > > Or do the statements need to be prepared, stepped, finalized > serially? > They can be run in any arbitrary order. That is the usual case, actually. -- D.

[sqlite] Multiple Prepared Statements

2015-05-08 Thread Scott Doctor
So if I have a loop that finds a row with some data (statement1) then based on values from that row sets fields in other rows statement2 find a row to set new data statement3 set column to something, repeat n times. then go back and do it all again x times. I can prepare the 3 statements first

[sqlite] Multiple Prepared Statements

2015-05-08 Thread Scott Doctor
Can I prepare multiple statements then implement them in arbitrary order (based on some logic)? Or do the statements need to be prepared, stepped, finalized serially? Scott Doctor scott at scottdoctor.com --

Re: [sqlite] Multiple prepared statements

2010-10-15 Thread Andrew Davison
Yup, my bad. Fixed. On 16/10/2010 12:03 AM, Andrew Davison wrote: > On 15/10/2010 11:49 PM, Pavel Ivanov wrote: >>> Now I decide that I want a second type of insert, so I try to use a >>> prepared statement for that as well. However it always fails. As long as >>> the other prepared statement is

Re: [sqlite] Multiple prepared statements

2010-10-15 Thread Andrew Davison
On 15/10/2010 11:49 PM, Pavel Ivanov wrote: >> Now I decide that I want a second type of insert, so I try to use a >> prepared statement for that as well. However it always fails. As long as >> the other prepared statement is hanging round I can't prepare a new one. >> Does this seem right or am I

Re: [sqlite] Multiple prepared statements

2010-10-15 Thread Pavel Ivanov
> Now I decide that I want a second type of insert, so I try to use a > prepared statement for that as well. However it always fails. As long as > the other prepared statement is hanging round I can't prepare a new one. > Does this seem right or am I really soing something wrong? You are doing

Re: [sqlite] Multiple prepared statements

2010-10-15 Thread P Kishor
On Fri, Oct 15, 2010 at 8:43 AM, Andrew Davison wrote: > In my database I do lots of inserts, of exactly the same nature so I use > a prepared statement, which I cache, always reseting after use. Works fine. > > Now I decide that I want a second type of insert, so I try

[sqlite] Multiple prepared statements

2010-10-15 Thread Andrew Davison
In my database I do lots of inserts, of exactly the same nature so I use a prepared statement, which I cache, always reseting after use. Works fine. Now I decide that I want a second type of insert, so I try to use a prepared statement for that as well. However it always fails. As long as the

Re: [sqlite] Multiple prepared statements

2008-11-26 Thread Oyvind Idland
*argh* more or less my bad, sqlite3_prepare_v2() instead of sqlite3_prepare() solved it. Oyvind. On Wed, Nov 26, 2008 at 5:29 PM, Igor Tandetnik <[EMAIL PROTECTED]> wrote: > Oyvind Idland <[EMAIL PROTECTED]> > wrote: > > I am using two prepared statements in my code (that does INSERT), > >

Re: [sqlite] Multiple prepared statements

2008-11-26 Thread Igor Tandetnik
Oyvind Idland <[EMAIL PROTECTED]> wrote: > I am using two prepared statements in my code (that does INSERT), > following the pattern > > prepare(stmt1) > prepare(stmt2) > > while (xx) > { > bind(stmt1) > step(stmt1) > reset(stmt1) > > bind(stmt2) > step(stmt2) > reset(stmt2) > } > > The

[sqlite] Multiple prepared statements

2008-11-26 Thread Oyvind Idland
Hi, according to documentation, "An application is allows to prepare multiple SQL statements in advance and evaluate them as needed. There is no arbitrary limit to the number of outstanding prepared statements." I am using two prepared statements in my code (that does INSERT), following the

Re: [sqlite] multiple prepared statements with INSERT?

2006-12-23 Thread Jay Sprenkle
On 12/21/06, E Tse <[EMAIL PROTECTED]> wrote: Hi guys, I ran into a strange problem. I have 2 prepared sqlite3_stmt, each inserting to different tables in a sqlite database: sqlite3_stmt* insertA; std::string sql = "insert into tablea(col1) values(?)"; int rc = sqlite3_prepare(db_, sql.c_str(),

[sqlite] multiple prepared statements with INSERT?

2006-12-21 Thread E Tse
Hi guys, I ran into a strange problem. I have 2 prepared sqlite3_stmt, each inserting to different tables in a sqlite database: sqlite3_stmt* insertA; std::string sql = "insert into tablea(col1) values(?)"; int rc = sqlite3_prepare(db_, sql.c_str(), sql.size(), , NULL); sqlite3_stmt* insertB;

[sqlite] Multiple prepared statements work on Windows... fails on Mac OS X

2006-04-13 Thread Slater, Chad
Hello, I'm using two prepared statements in a block of cross platform C++ code like this (very roughly): { sqlite3_stmt * pstmt1 = NULL; sqlite3_stmt * pstmt2 = NULL; pstmt1 = PrepareAndBind(...); // Prepare and bind one statement pstmt2 = PrepareAndBind(...); // Prepare