On Sat, 23 Apr 2011 09:39:40 -0400 Sam Carleton <scarle...@miltonstreet.com> wrote:
> Can someone then explain the purpose of sqlite3_clear_bindings()? If > I understand things correctly, you call sqlite3_reset() to reuse a > prepaired statement, why do you call sqlite3_clear_bindings()? Is it > because sqlite3_reset() does not actually clear the binding values, > just resets the preparied statement? I have a feeling this is the > case, so... Yes, take for example a SELECT * FROM table WHERE name='John' statement, for each step it gets one 'John' row. At step n, it will give you the n-th 'John' row, but if you reset it, you'll get the first 'John' row again, though it's still 'John' that was bound to the statement, it won't change (to the default NULL) unless you call clear bindings. > > I understand things correctly, you call sqlite3_reset() to reuse a > > prepaired statement, why do you call sqlite3_clear_bindings()? > > You don't have to. Personally, I've never once found a use for it. I now realize that I used it several times for no good reason. :) However, I think it's safer to use it, it's easier to debug a problem involving an unwelcome NULL than an arbitrary incorrect entry, in case something goes wrong. -- Mihai Militaru <mihai.milit...@xmpp.ro> _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users