Permalink
Browse files

* SQLite node.js store, minor indentation tweaks, link to node-sqlite

* project
* Minor tweak to sqlite test
* Added Eugene to authors
  • Loading branch information...
1 parent 3e48e67 commit cc33adec42275fdb5fee483efc692f05281ce53a @zefhemel zefhemel committed Feb 10, 2011
Showing with 10 additions and 9 deletions.
  1. +1 −0 AUTHORS
  2. +8 −8 lib/persistence.store.sqlite.js
  3. +1 −1 test/node/test.sqlite.store.js
View
@@ -13,3 +13,4 @@ Mike Smullin <mike@smullindesign.com>
Masahiro Hayashi <hayashi.masahiro@gmail.com>
Mick Staugaard <mick@staugaard.com>
Shane Tomlinson <set117@gmail.com>
+Eugene Ware <eugene.ware@nextharbour.com>
@@ -1,11 +1,12 @@
/**
- * This back-end depends on the node.js asynchronous MySQL driver as found on:
- * http://github.com/felixge/node-mysql/
+ * This back-end depends on the node.js asynchronous SQLite driver as found on:
+ * https://github.com/orlandov/node-sqlite
* Easy install using npm:
- * npm install mysql
+ * npm install sqlite
+ * @author Eugene Ware
*/
var sys = require('sys');
-var sql = require('persistencejs/persistence.store.sql');
+var sql = require('./persistence.store.sql');
var sqlite = require('sqlite');
var db, username, password;
@@ -18,8 +19,8 @@ function log(o) {
exports.config = function(persistence, dbPath) {
exports.getSession = function(cb) {
var that = {};
- var conn = new sqlite.Database();
- conn.open(dbPath, cb);
+ var conn = new sqlite.Database();
+ conn.open(dbPath, cb);
var session = new persistence.Session(that);
session.transaction = function (explicitCommit, fn) {
@@ -39,14 +40,13 @@ exports.config = function(persistence, dbPath) {
session.close = function(cb) {
conn.close(cb);
- //conn._connection.destroy();
};
return session;
};
function transaction(conn){
var that = {};
- // TODO: add check for db opened or closed
+ // TODO: add check for db opened or closed
that.executeSql = function(query, args, successFn, errorFn){
function cb(err, result){
if (err) {
@@ -33,7 +33,7 @@ module.exports = {
});
},
add: function(done) {
- task = new Task(data);
+ task = new Task(session, data);
session.add(task);
session.flush(function(result, err) {
assert.ifError(err);

0 comments on commit cc33ade

Please sign in to comment.