sqlite_open
sqlite_get_table
sqlite_get_row
sqlite_get_array
sqlite_exec
sqlite_changes

SQLite Module Function Reference

sqlite_open

Synopsis

Open a SQLite database

Usage

Sqlite_Type sqlite_open(String_Type filename)

Description

Open the sqlite database file filename. If the database file does not exist, then a new database will be created as needed. On failure a SqliteError exception is thrown.

See Also

sqlite_get_table, sqlite_get_array, sqlite_get_row, sqlite_exec, sqlite_changes

sqlite_get_table

Synopsis

Get a table of results from a SQLite query

Usage

String_Type[] sqlite_get_table(Sqlite_Type db, String_Type query)

Description

This executes a query and returns the result as a 2d array of strings. The first row of the array contains the column headers. This function does not support placeholders.

Notes

You should only use this function if you need the column headers. Otherwise, use sqlite_get_table

See Also

sqlite_open, sqlite_get_row, sqlite_exec, sqlite_changes

sqlite_get_row

Synopsis

Get a row of results from a SQLite query

Usage

sqlite_get_row(Sqlite_Type db, String_Type query, ...)

Description

This executes a query and pushes the elements of the first row of the result on the stack. This supports string, integer, float and blob datatatypes. Blobs are returned as bstrings. If there are no rows, a SqliteError exception is thrown even if the query executed flawlessly. Question marks in the query are placeholders. Extra arguments to the function are bound to these placeholders from left to right.

Example

   (foo, bar) = sqlite_get_row("SELECT foo, bar FROM table WHERE baz = ?", "quux");

Notes

To get the result of a query that returns multiple rows, use sqlite_get_array or use
  foreach foo, bar (db) using ("SELECT foo, bar FROM table WHERE baz = ?", "quux")
  {
      ....
  }

See Also

sqlite_open, sqlite_get_table, sqlite_exec, sqlite_changes

sqlite_get_array

Synopsis

Get a 2-D array from a SQLite query

Usage

Array_Type sqlite_get_array(Sqlite_Type db, DataType_type type, String_Type query, ...)

Description

Executes a query and returns the result as a 2d array of type type. This supports string, integer, float and blob datatatypes. Question marks in the query are placeholders. Extra arguments to the function are bound to these placeholders from left to right.

See Also

sqlite_open, sqlite_get_table, sqlite_get_array, sqlite_get_row, sqlite_exec, sqlite_changes

sqlite_exec

Synopsis

Execute a SQLite query

Usage

sqlite_exec(Sqlite_Type db, String_Type query, ...)

Description

Execute a SQL query on a sqlite database, without returning a result. Question marks in the query are placeholders. Extra arguments to the function are bound to these placeholders from left to right.

Example

  sqlite_exec("INSERT INTO table(foo,bar,baz) VALUES (?,?,?)", 1, 2, 3);

See Also

sqlite_open, sqlite_get_table, sqlite_get_array, sqlite_get_row, sqlite_changes

sqlite_changes

Synopsis

Get the number of rows affected by a SQLite query

Usage

Int_Type sqlite_changes(Sqlite_Type db)

Description

This function returns the number of database rows that were changed (or inserted or deleted) by the most recently completed INSERT, UPDATE, or DELETE statement. The change count for "DELETE FROM table" will be zero regardless of the number of elements that were originally in the table.

See Also

sqlite_open, sqlite_get_table, sqlite_get_array, sqlite_get_row, sqlite_exec