I also needed this for some special update queries.
Without many details, it was some kind of "insert into xxx select
<row()>, otherfields from source order by <custom function>".
For this case there is a workaround, selecting first into a temporary
table with auto generated rowid and using it afterwards for insert.
There are lots of other cases where this would be handy, e.g. showing
ordinal of some results.
Of course it is simple to implement when the loop is under your control.
But sometimes there are libraries (components) which are interfaced only
by a cursor.
E.g a listing/grid showing cursor results, where you can NOT control the
implementation but want to show "row" as a column.
I currently use another workaround for this, declaring a user function
which simply increments/returns a counter.
As long as the queries are simple it is ok, but wrong usage is easily
possible (e.g. multiple times per row).
As the sqlite query program already has an internal loop, it would be
very easy to increment a counter for each "next" opcode and return it
via a special function or pseudo column.
I believe such a counter already exists for "LIMIT" clause, so most of
the work is already done...
Regards,
Gabriel
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users