Interested in improving this site? Please check the To Do page.
sqlite.stepQuery
Move forward a row in an SQLite query
Syntax
sqlite.stepQuery(queryID)
Params
queryID is the query ID returned by sqlite.compileQuery.
Returns
An SQLite result code.
Examples
on easyQuery (dbID, queryString, maxRows=0) {
local (compiledQuery, dataset={}, row, rowCount=0);
compiledQuery = sqlite.compileQuery(dbID, queryString);
loop {
result = sqlite.stepQuery(compiledQuery);
if result != 100 { // SQLite's code for more rows
break};
++rowCount;
if (maxRows > 0) and (rowCount > maxRows) {
break};
row = sqlite.getRow(compiledQuery);
dataset[rowCount] = row};
sqlite.clearQuery(compiledQuery);
return dataset}
Notes
The above example is the script code for the sqlite.easyQuery function. As you can see, it iterates through the returned rows, building up a list of results.
The key to using sqlite.stepQuery is checking the result code. SQLite returns an integer 100 value, indicating there is another step ready.