On Tue, Nov 01, 2011 at 02:01:30PM +0000, Black, Michael (IS) scratched on the wall: > Hmmm...how hard would it be allow one to bind the table name with prepare?
Generally, "very." Or, rather, it would be fairly straight forward if you're willing to skip the query optimization step and do all look-ups as linear table scans and all joins as nested loops. Much of the query construction, including the use of indexes, join optimizations, constraints, keys, and everything else is based off knowing which specific tables and columns are being accessed. You'd also need to give up most of the query sanity checking, since you wouldn't be able to do things like verify that a named column actually exists in the unspecified table. If you were to do all that work after "binding" the identifier names, you'd more or less be re-preparing the whole statement. So you might as well just re-prepare the statement. Besides, getting back to some comments from before, if you've got a whole series of tables with the same structure, so that you can take advantage of this kind of thing, you likely need to rethink your database design. Yes, it would be a minor convenience from time to time, but generally reuse comes from very simple statements that are easy to simply rebuild. -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