Sqlite driver for RingoJS with API similar to ADOdb for PHP.
var sqlite = require("ctlr-sqlite");
sqlite.connect("/path/to/file.sqlite");
var one_value = sqlite.get_one("select id from table limit 0,1");
var rows = sqlite.get_all("select * from table");
var id = sqlite.prepared_query("insert into ? (?,?) values(?,?)", ["table", "name", "email", "User", "user@example.org"]);| Connection | connect( file_name ) | Connects to the database stored in the file. |
| void | close( [Connection] ) | Close a connection to a database. |
| Connection | getConnection( [Connection] ) | Returns the last opened Connection or the provided Connection. |
| ResultSet / number | query( sql, [Connection] ) | Executes the sql query. |
| ResultSet / number | prepared_query( sql, parameters[], [Connection] ) | Executes the sql query with provided parameters. |
| Object | get_row( sql/ResultSet ) | Retrieves one row. |
| Array | get_all( sql/ResultSet ) | Retrieves all rows. |
| Iterator | get_iterator( sql/ResultSet ) | Returns an Iterator on all rows in result.
Note: due to Sqlite recommendation to close all resultsets ASAP for better performance this is just a wrapper around get_all(). |
| Array | get_col( sql/ResultSet, [column=1] ) | Retrieves all values of one column. |
| mixed | get_one( sql/ResultSet ) | Retrieves the first column value from the first row. |
- RingoJS v0.8
This is free software, and you are welcome to redistribute it under certain conditions; see LICENSE.txt for details.
- John Lim for his ADOdb Database Abstraction Library for PHP (an inspiration for this package).
- David Crawshaw for SQLite JDBC Driver.
Emilis Dambauskas emilis.d@gmail.com, http://emilis.github.com/