sqlite logo

Introduction

The SQLite module makes the SQLite database available in JavaScript.

Database

sqlite.Database represents a database. When the database doens't exist, the database will be created.

var db = new sqlite.Database("person.db");

Executing SQL statements

SQL statements can be executed with exec or prepare. Use exec when you don't need information from the database:

db.exec("CREATE TABLE person(name TEXT, nr INTEGER)");

Use prepare when you need information from the database. prepare will return a sqlite.Statement object. sqlite.Statement allows you to iterate the results of the SQL statements.

var stmt = db.prepare("SELECT * FROM person");
var row;
while(row = stmt.fetchObject())
{
  print(row.name);
  print(row.nr);
}




Design downloaded from Zeroweb.org: Free website templates, layouts, and tools.