Cole Tuininga wrote: > > (tangental question - is it enough to just keep rebinding to a query? > Or do I need to call sqlite3_clear_bindings every time?).
There is no need to clear the bindings. If you don't clear the bindings you only need to rebind the values that changed. > The table > in question is pretty simple: key/value for the moment. The select > looks up a value based on the key. The thing is that I'm only making > requests for keys that I know exist, and this doesn't seem to be > giving me any results. That is, sqlite3_step is returning SQLITE_DONE > after the first call each time I run it. > > I'm making sure to call sqlite3_reset on the handle each time. > > The question is, is there an easy way to extract the actual query > (with the bound variable set) from the statement handle? I'm looking > to make sure that I'm actually binding the expected value into the > query. Thanks. > As far as I know, there is no way to get the query with the bound values replaced. However, you can transfer the bindings from one query to another so you could transfer the bindings from your query to a simple select with the same number of parameters. You do this using the obsolete sqlite3_transfer_bindings() API (see http://www.sqlite.org/c3ref/aggregate_count.html) Say you have a select that uses three parameters select a, b, c from t1 where b < ?1 and c > ?2 or d = ?3 You can prepare a select like this select ?1, ?2, ?3 and then transfer the bindings from the first select to the second. When you run the second query it will return the values you bound to the first query before calling sqlite3_transfer_bindings(). HTH Dennis Cote _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users