summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--backend/node/src/clipperz.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/backend/node/src/clipperz.js b/backend/node/src/clipperz.js
index 5b4df0a..37b9cae 100644
--- a/backend/node/src/clipperz.js
+++ b/backend/node/src/clipperz.js
@@ -18,49 +18,49 @@ function clipperz_store(PG) {
var rv = function(o) { express_store.call(this,o); }
rv.prototype.get = function(sid,cb) { PG.Q(
"SELECT s_data FROM clipperz.thesession WHERE s_id=$1",[sid],
function(e,r) { cb(e,(e||!r.rowCount)?null:JSON.parse(r.rows[0].s_data)); }
) };
rv.prototype.set = function(sid,data,cb) {
var d = JSON.stringify(data);
PG.Q(
"UPDATE clipperz.thesession SET s_data=$1, s_mtime=current_timestamp"
+" WHERE s_id=$2",[d,sid], function(e,r) {
if(e) return cb(e);
if(r.rowCount) return cb();
PG.Q("INSERT INTO clipperz.thesession (s_id,s_data) VALUES ($1,$2)",[sid,d],cb);
});
};
rv.prototype.destroy = function(sid,cb) { PG.Q(
"DELETE FROM clipperz.thesession WHERE s_id=$1",[sid],cb
) };
rv.prototype.length = function(cb) { PG.Q(
"SELECT count(*) AS c FROM clipperz.thesession", function(e,r) {
cb(e,e?null:r.rows[0].c);
}
) };
rv.prototype.clear = function(cb) { PQ.Q(
- "DELETE FROM clipperz.thesession", cb
+ "TRUNCATE clipperz.thesession", cb
) };
rv.prototype.__proto__ = express_store.prototype;
return rv;
}
var srp_g = BIGNUM(2);
var srp_n = BIGNUM("115b8b692e0e045692cf280b436735c77a5a9e8a9e7ed56c965f87db5b2a2ece3",16);
var n123 = '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00';
var CLIPPERZ = module.exports = function(CONFIG) {
var LOGGER = CONFIG.logger||{trace:function(){}};
var PG = {
url: CONFIG.psql,
PG: require('pg').native,
Q: function(q,a,cb) {
if('function'===typeof a) cb=a,a=[];
LOGGER.trace({query:q,args:a},'SQL: %s',q);
PG.PG.connect(PG.url,function(e,C,D) {
if(e) return cb(e);
var t0=new Date();
C.query(q,a,function(e,r) {