Hello again, It's probably bad to answer ones own question!
I fixed my problem with a call to sqlite_expired before calling sqlite_reset. If sqlite_expired returns non zero then I do sqlite_finalize and sqlite_prepare before sqlite_reset. I think that sqlite_step might be returning a stale error_code. It's a workaround, I know, but it works. Regards, Carl. ----- Original Message ----- From: "Carl Jacobs" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Thursday, March 09, 2006 5:50 PM Subject: [sqlite] "not an error" > Hello, > > I have the following process (roughly) on a 3.xx database: > > == Start of process == > 1) sqlite_prepare (an insert statement which is then used many times) > 2) loop to insert data (thousands of iterations) > sqlite_reset / sqlite_bindxxx / sqlite_step > 3) 'ATTACH DATABASE secondary' > do some processing on attached database > 'DETACH DATABASE secondary' > 4) sqlite_reset on prepared query from step 1 > at this point I get an SQLITE_SCHEMA error so I do an sqlite_finalize of > the old prepared statement, and sqlite_prepare a new statement - which is > the same as step 1. > 5) sqlite_reset - return value is SQLITE_OK > 6) sqlite_bindxxx - they all seem to work OK. > 7) sqlite_step - ERROR!! Return code is 1, and a call to sqlite_errmsg > gives the result "not an error". > == End of process == > > == More information == > => In step 1 three inserts are prepared. > => In step 2 the three prepared statement are interleaved. (reset1, bind1, > step1, reset2, bind2, step2 etc) > => Steps 4, 5, 6, 7 are an expansion of step 2 - it's the same function > call. > => In step 4 only the first of the three queries is re-prepared before the > error in step 7. > > BUT, the error is sort-of self-fixing! > So this is my program, and what happens: > { > sqlite_open() > Step1() - Success > Step2() - Success > Step2() - Success > Step3() - Success > Step2() - SQLITE_SCHEMA on reset1, so finalize1 prepare1 then error_code 1 > on step1 and exit > Step2() - SQLITE_SCHEMA on reset2, so finalize2 prepare2 then error_code 1 > on step2 and exit > Step2() - SQLITE_SCHEMA on reset3, so finalize3 prepare3 then error_code 1 > on step3 and exit > Step2() - Success > Step2() - Success > Step3() - Success > Step2() - SQLITE_SCHEMA on reset1, so finalize1 prepare1 then error_code 1 > on step1 and exit > Step2() - SQLITE_SCHEMA on reset2, so finalize2 prepare2 then error_code 1 > on step2 and exit > Step2() - SQLITE_SCHEMA on reset3, so finalize3 prepare3 then error_code 1 > on step3 and exit > Step2() - Success > Step2() - Success > } > > Step2 inserts the same data everytime. > > So what "officially" should I do with an error code of 1 as the result of an > sqlite_step? > > Regards, > Carl. >

