Interested in improving this site? Please check the To Do page.

Back to SQLite Verbs

sqlite.easyQuery

Perform a query and retrieve the entire results table.

Syntax

sqlite.easyQuery (dbID, queryString, maxRows=0)

Params

dbID is the database ID returned by sqlite.open. queryString is an SQL query string. maxRows is an optional parameter. If provided, it determines the maximum number of rows returned in the query.

Returns

A Frontier list containing the results of the query. The list returned contains, as elements, one Frontier list corresponding to each row returned from the query.

Examples

query = "select category, count(category) from verbs group by category";
output = sqlite.easyQuery (db, query, 4);
	 » {{"app", 40}, {"backups", 2}, {"base64", 2}, {"batchExporter", 3}}

Notes

sqlite.easyQuery is the easiest way to do a quick SQL operation. Be aware, however, that intelligent result codes are not returned. The only information you're going to get back is the list of lists. Presumably, an empty list will indicate that no data was returned. Also, for queries that return a single element, you'll get back a list containing a list, like shown below and you'll need to extract the relevant details, as in this example:

a = {{"Frontier"}}; a[1][1]
	 » "Frontier"

See Also


Personal Tools