#!/usr/bin/env node /* sqlitedb.get("SELECT json FROM rank WHERE user=?",key,(err,json)=>{ if(notindb) return sqlitedb.run('INSERT INTO rank (user,json) VALUES (?,?)',key,JSON.stringify(obj),cb); sqlitedb.run('UPDATE rank SET json=? WHERE user=?',JSON.stringify(obj),key,cb); */ var db = require('./sqlitedb'); db.run('CREATE TABLE rank (user text primary key,json text)',console.log); /* todo.js: async.map(ids,(id,cb)=>sqldb.get('Select id,title from titles where user=? and id=?',user,id,cb),cb); todo.js: sqldb.run('Insert into titles values (?,?,?)',user,i,tasktext,noop); todo.js: sqldb.run('Insert into titles values (?,?,?)',user,i,tasktext,noop); todo.js: sqldb.get('Select title from titles where user=? and id=?',user,taskid,(err,result)=>{ todo.js: sqldb.run('Delete from titles where user=? and id=?',user,taskid,err=>{ todo.js: sqldb.get('Select title from titles where user=? and id=?',user,taskid,(err,titleobj)=>{ todo.js: sqldb.all(`Select id,title from titles where user=? and ${titlefrags}`,user,cb); todo.js: sqldb.run('Update titles Set title=? Where user=? and id=?',title,user,id,cb); todo.js: async.map(selectedids,(id,cb)=>sqldb.get('Select id,title from titles where user=? and id=?',user,id,cb),cb); */ db.run('CREATE TABLE titles (user text,id integer,title text)'); db.run('CREATE INDEX titles_idx ON titles(user,id)'); /* data2.js: sqldb.get('Select json from day where user=? and day=?',user,date,(err,result)=>{ data2.js: sqldb.run('INSERT into day (user,day,json) values (?,?,?)',user,day,stringified); data2.js: sqldb.run('UPDATE day SET json=? WHERE user=? AND day=?',stringified,user,day); */ CREATE TABLE day (user text not null,day text not null,json text not null); CREATE UNIQUE INDEX day_idx ON day(user,day);