On Mon, Jul 12, 2010 at 09:45:20AM -0400, Sam Carleton scratched on the wall: > Michael, > > Actually I am building the string myself and it is very controlled, the Id's > are coming from an internal source, but it violates my general rule of never > building query strings. Of course there are always exceptions to the rule > and it looks like this is one of those exceptions.
It is a good rule. I encourage you to follow it when you can. Why not just build the query string with the correct number of parameters, and then bind them explicitly? It is a bit extra code, but the performance is likely to be very similar, if not better, since you avoid all the type conversions. You might even be able to cache statements that contain frequently used lengths. Depending on how critical performance and memory is, I might also build a set of statements with, for example, 2, 4, 8, 16, etc., parameters. Find the one that fits what you need, and bind NULLs to the end (or just call sqlite3_clear_bindings()). NULL IN ( NULL ) returns NULL, but ( NULL IN ( NULL ) IS 1 ) will return 0. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users