sqlite-sync.js
Node module to sqlite sync and async
node.js package for database connection with SQLite , and execute SQL commands synchronously or asynchronously.
Install
npm install sqlite-sync
Usage
var sqlite = require('sqlite-sync');
sqlite.connect('test/test.db');
sqlite.run("CREATE TABLE COMPANYS(ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL);",function(res){
if(res.error)
throw res.error;
console.log(res);
});
sqlite.insert("COMPANYS",{NAME:"My COMPANY"}, function(res){
if(res.error)
throw res.error;
console.log(res);
});
var rows_modified = sqlite.update("COMPANYS",{NAME:"TESTING UPDATE"},{ID:1});
function test(a,b){
return a+b;
}
sqlite.create_function(test);
console.log(sqlite.run("SELECT ID, test(NAME, ' Inc') as NAME FROM COMPANYS"));
sqlite.close();