Re: [sqlite] reset after failed step

2017-03-17 Thread Richard Hipp
On 3/17/17, Jan Danielsson  wrote:
>
>I.e. reset should only be run on ROW and DONE.  On step error, the
> statement's state is reset implicitly by sqlite3_step()?

No.  Always run sqlite3_reset().

-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] reset after failed step

2017-03-17 Thread Jan Danielsson
Hello,

   Is this (conceptually) correct:

   -
   .. bind arguments ..

   sqlrc = sqlite3_step(stmt);
   if(sqlrc == SQLITE_ROW || sqlrc == SQLITE_DONE) {
 sqlrc = sqlite3_reset(stmt);
 assert(sqlrc == SQLITE_OK);
   }

   .. bind other arguments ..

   sqlrc = sqlite3_step(stmt);
   if(sqlrc == SQLITE_ROW || sqlrc == SQLITE_DONE) {
 sqlrc = sqlite3_reset(stmt);
 assert(sqlrc == SQLITE_OK);
   }

   sqlrc = sqlite3_finalize(stmt);
   assert(sqlrc == SQLITE_OK);
   -

   I.e. reset should only be run on ROW and DONE.  On step error, the
statement's state is reset implicitly by sqlite3_step()?

-- 
Kind regards,
Jan Danielsson

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users