Denis Gorodetskiy <[email protected]> wrote: > The right way to query sqlite is to use sqlite3_prepare() and > sqlite3_bind_xxx() and then sqlite3_step(). > How do you build complex queries of form > > "SELECT * FROM parent WHERE id IN > (SELECT parent_id FROM child_table1 WHERE child_param1=x AND > child_param2=y INTERSECT > SELECT parent_id FROM child_table2 WHERE child_param3=z);" > > Let's assume this query will be built in runtime dynamically, > i.e. we don't know in compile time how many children attribute > conditions will be given.
sqlite3_prepare et al cannot change the structure of the query - all it can do is allow you to run the same query with different literals. If you need to build the query on the fly against a database schema that is not known up front, then there's no way around some sort of string manipulation (it doesn't have to be sprintf). Igor Tandetnik _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

