Top Documents Download Gallery Repository
Are you looking for a Software Engineer? Check Here

46sqlite3 Module

The sqlite3 module provides measures to access SQLite3 database. To utilize it, import the sqlite3 module using import function.

46.1sqlite3.db Class

46.1.1Constructor

sqlite3.db
sqlite3.db(filename:string) {block?}
Opens an sqlite3 database file and returns a connection handle with the database.

If block is specified, it would be evaluated with a block parameter |db:sqlite3|, where db is the created instance. In this case, the block's result would become the function's returned value. The connection handle will be automatically closed when the block finishes.

46.1.2Method

sqlite3.db#close
sqlite3.db#close()
Shuts down the connection with an sqlite3 server.

sqlite3.db#exec
sqlite3.db#exec(sql:string):map
Executes an SQL statement and creates an list that has list instances containing queried result as its elements.

sqlite3.db#getcolnames
sqlite3.db#getcolnames(sql:string):map {block?}

sqlite3.db#query
sqlite3.db#query(sql:string):map {block?}
Executes an SQL statement and creates an iterator that returns list instances containing queried result as its elements.

You should use sqlite3.db#query() instead of sqlite3.db#exec() when it's likely that you get a large size of data as the result.

sqlite3.db#transaction
sqlite3.db#transaction() {block}
Executes the block within a transaction. The process is like following:

  1. Executes a sqlit3 command 'BEGIN TRANSACTION'.
  2. Executes code in the block.
  3. Executes a sqlite3 command 'END TRANSACTION'.

46.2Thanks

This module uses SQlite3 library which is distributed in the following site:

http://www.sqlite.org/index.html


Copyright (C) 2011-2017 ypsitau