1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
<?xml version="1.0"?>
<chapter id="sqlite-module" xmlns:xi="http://www.w3.org/2003/XInclude">
<chapterinfo>
<author>
<firstname>Robert</firstname>
<surname>Carr</surname>
<affiliation>
<address>
<email>racarr@<parameter>gnome.org</parameter></email>
</address>
</affiliation>
</author>
</chapterinfo>
<title>SQLite</title>
<refsect1>
<title>API Reference</title>
<para>
The sqlite module allows for manipulation and querying of sqlite databases.
<programlisting>
sqlite = imports.sqlite;
</programlisting>
</para>
The SQLite module provides a selection of status enums, to be used as the return values of functions. For meanings, consult the SQLite C documentation.
<programlisting>
sqlite.[OK, ERROR, INTERNAL, PERM ABORT, BUSY,
LOCKED, NOMEM, READONLY, INTERRUPT, CORRUPT,
NOTFOUND, FULL, CANTOPEN, PROTOCOL, EMPTY,
SCHEMA, TOOBIG, CONSTRAINT, MISMATCH, MISUSE,
NOLFS, AUTH, FORMAT, RANGE, NOTADB, ROW, DONE]
</programlisting>
<xi:include href="sqlite-funcs.xml"/>
</refsect1>
<refsect1>
<title>Examples</title>
<para>Below are several examples of using the Seed sqlite module. For additional resources, consult the examples/ folder of the Seed source</para>
<example id="readline-repl-example">
<para>This demonstrates creating a new table, populating it, and querying it for results</para>
<programlisting>
sqlite = imports.sqlite;
var db = new sqlite.Database("people.db");
db.exec("create table people (key INTEGER PRIMARY KEY, name TEXT," +
"age INTEGER, phone TEXT);");
db.exec("insert into people(name, age, phone) " +
"values('John Smith', 24, '555-123-4567');");
function cb_print_phone(results) {
print(results.phone);
}
db.exec("select * from people where name='John Smith';", cb_print_phone);
db.close();
</programlisting>
</example>
</refsect1>
</chapter>
|