Sqlite Toolkit - @octave_sqlite/fetch


: data = fetch (db, sqlquery)
: data = fetch (db, sqlquery, propertyname, propertyvalue …)

Run a SQL query on a sqlite database

Return rows of data after running a SQL query on a sqlite database.

Inputs

db

currently open sqlite database.

sqlquery

String containing a valid select SQL query.

propertyname, propertyvalue

property name/value pairs where known properties are:

MaxRows

Integer value of max number of rows in the query

VariableNamingRule

String value ’preserve’ (default) or ’modify’ to flag renaming of variable names (currently ignored)

RowFilter

dbrowfilter object to filter results

Outputs

data

a table containing the query result.

Examples

Select all rows of data from a database tables

 
 # create sql connection
 db = sqlite("mytest.db");
 data = fetch(db, 'SELECT * FROM TestTable');
 
 

Select 5 rows of data from a database tables

 
 # create sql connection
 db = sqlite("mytest.db");
 data = fetch(db, 'SELECT * FROM TestTable', "MaxRows", 5);
 
 

See also: sqlite, sqlread.