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