Home  Contents

sql.new

Sql Core4 Lua Commands

SYNOPSIS

  1. db = sql.new()
  2. db = sql.open(filename)

DESCRIPTION

Both functions create a new database handle.

The first form sql.new() creates an uninitialized object. Before use, a database must be opened using sql:open().

The second form sql.open() will open the specified database file.

A open database handle can be used to run SQL statements by calling any of the sqlquery methods on it. Concurrent queries on the database can be held open by allocating further handles on the same database with sql:newquery().

Additionally, the database handle provides a lightweight settings API to keep application settings that are traditionally stored in ini-files. See sql:setValue() and sql:getValue().

RETURN VALUE

On success, returns a new database handle. On failure, three values are returned: nil, a string describing the error and the errno number from the database engine.

SEE ALSO