Thanks, that is very useful. Maybe this should be more clearly (and simple) in the documentation somewhere.
RBS On Fri, Mar 20, 2015 at 12:23 AM, Igor Tandetnik <igor at tandetnik.org> wrote: > On 3/19/2015 7:48 PM, Bart Smissaert wrote: > >> I know this is basic and should be in the documentation, but it is not >> quite clear to me. >> Basically I have 3 type of procedures: >> >> 1. Getting values from a table. For this I have the following steps: >> >> (Open) >> Prepare >> >> Then in a loop: >> >> Step >> ColumnInt, ColumnDouble, ColumnText >> >> After the loop: >> >> Finalize >> > > Looks good to me. > > 2. Putting values in a table: >> >> (Open) >> Start Transaction >> Prepare >> > > These two could be in any order > > Then in a loop: >> Bind >> Step >> Reset >> >> After the loop: >> >> Clearbindings >> Finalize >> Commit Transaction >> > > It's pointless to clear bindings right before finalize. And commit could > happen either before or after. > > 3. Non looped procedures, eg, delete and update: >> >> (Open) >> Prepare >> Step >> Reset >> Finalize >> > > You don't need reset before finalize. > > Is this all how it should be? >> > > It'll work. There are a few redundancies, but they are harmless. > > Where/when should I call sqlite3_close? >> > > When you no longer need the connection, of course. > > Does Clearbindings come indeed before finalize? >> > > I have yet to find a reason to call sqlite3_clear_bindings. It's needed > very rarely, if ever. It's absolutely pointless right before finalize. > -- > Igor Tandetnik > > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >