NO. ORDER BY is satisfied either by an index or by a separate sorting step, depending on whatever indexes are present or maybe even created on the fly by SQLite. The choice affects the generated SQL byte code (=the prepared statement), so it would have to re-prepare the statement anyway.
Parameters are for substituting LITERALS, not arbitrary elements of SQL syntax. Even though the syntax would theoretically allow "... ORDER BY ?", it would evaluate to a constant expression (the value bound to the parameter) and thus not very useful for determining the order (and NO you CANNOT call sqlite3_bind_xxx() after sqlite3_step() has been called). -----Ursprüngliche Nachricht----- Von: d b [mailto:[email protected]] Gesendet: Donnerstag, 05. Dezember 2013 10:49 An: [email protected] Betreff: [sqlite] prepared statemnt for column names and sorting preference Hi, select * from emp order by empid desc; //here empid is column name among clolumns. Now, I want to write prepared statement for above query. select * from emp order by ? ?; //I want to substitute column name and sorting preference. is it possible with sqlite? thanks, a _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -------------------------------------------------------------------------- Gunter Hick Software Engineer Scientific Games International GmbH Klitschgasse 2 – 4, A - 1130 Vienna, Austria FN 157284 a, HG Wien Tel: +43 1 80100 0 E-Mail: [email protected] This e-mail is confidential and may well also be legally privileged. If you have received it in error, you are on notice as to its status and accordingly please notify us immediately by reply e-mail and then delete this message from your system. Please do not copy it or use it for any purposes, or disclose its contents to any person as to do so could be a breach of confidence. Thank you for your cooperation. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

