Home  Contents

sql:open

Sql Core4 Lua Commands

SYNOPSIS

db:open(filename)

DESCRIPTION

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().

If another file was already open on that handle, it is closed first. Any query handle that was acquired with sql:newquery() becomes unusable. Attempt to use such a query handle throws a Lua exception.

RETURN VALUE

On success, returns true. On failure, returns nil. In case of an error, the error can be retrieved using sql:lastError().

SEE ALSO