Function “openSQLiteDatabase”
function openSQLiteDatabase(url)
Opens an SQLite database file.
Note that the database will be opened in read-only mode.
Parameters
| Name | Type | Description |
|---|---|---|
url | string | URL to the SQLIte file - should be a "file://" URL |
Return Value
Returns a SQLiteDatabase object with the opened database.
Errors
If any error occurs while opening the database, an error will be thrown.
Example
var db = openSQLiteDatabase(file)
var stmt = db.prepare("SELECT name, address FROM Clients WHERE active=1");
while (true) {
var row = stmt.step()
if (!row) break
print("Client: " + row[0].value)
print(" resident at " + row[1].value)
}
stmt.finalize()
db.close()