Wednesday, October 21, 2009

iPhone dev Stupidity 81: SQLite3 Cursor?

DECLARE CURSOR c1
FOR
SELECT * FROM arts

will cause an error.

Seems not supported yet - that's why there's PL\SQL


SQLite3 doc on Scrolling Cursor:
* You can use sqlite3_step to simulate a forward cursor


Rule Number 1: Do not leave queries open waiting for the user input. Run a query to fill up the screen with as much information as it will hold then reset() or finalize() the query statment. Get in, grab your data, then get out. Later on, when the user decides to scroll up or down (which will usually be eons of time later from the point of view of your CPU), run another query to refresh the screen with new data.

Rule Number 2: Do not try to implement a scrolling window using LIMIT and OFFSET. Doing so will become sluggish as the user scrolls down toward the bottom of the list.

No comments: