Danny Milosavljevic wrote:
> I'm trying to prepare a statement for "SELECT a FROM t ORDER BY ?" and
> then sqlite3_bind_int the parameter to 1 (on sqlite 3.19.3).
>
> Expected result: Orders result by column "a", in ascending order.
> Observed result: Orders in some strange order.

Ordering by column number works only for a plain integer.  A parameter
might not be an integer, so it is parsed differently, even if the
actual value later ends up being an integer.

So the effect is that you are sorting by a constant value: it's the
same for all rows, so the order of the output rows is undefined.


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to