Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (25 sloc) 648 Bytes
An.object().named('Database').
has('callback',function() {} ).
does('init', function(Name) {
try {
has('sql',openDatabase(Name,'','Phos Database',4096*4096))
} catch(E) {
console.error(E);
}
return this;
}).
does('query', function(Q,F) {
var I = this
var Args = Array.prototype.slice.apply(arguments,2)
this.has('callback',F)
this.sql().transaction(function(T) { T.executeSql(Q,Args,I.result,I.failure) });
return this;
}).
does('result', function(T,R) {
R.every(this.callback())
this.has('results',R)
}).
does('failure', function(T,E) {
console.error('Database Error: ' + E.message)
this.has('error',E)
})