function Database(a){console.log(a);var b=$.extend(null,{name:"database",version:"0.1",displayName:"database",estimatedSize:5242880,onOpen:null},a);this.db=openDatabase(b.name,b.version,b.displayName,b.estimatedSize,b.creationCallback),console.log(this.db)}Database.prototype.createTable=function(a){var b=$.extend(null,{name:"table",fields:[],callback:null},a);this.db.transaction(function(a){console.log(a),a.executeSql("CREATE TABLE IF NOT EXISTS "+b.name+" ("+b.fields.toString()+")")})},Database.prototype.clearTable=function(a,b){this.db.transaction(function(c){c.executeSql("DELETE FROM "+a,null,b)})},Database.prototype.addRow=function(a,b){var c=$.extend(null,{table:"table",params:[]},a);this.db.transaction(function(a){a.executeSql("INSERT INTO "+c.table+" VALUES ("+$.map(c.params,function(){return"?"}).join(",")+")",c.params,b)})},Database.prototype.removeRow=function(a,b){var c=$.extend(null,{table:"table",params:[]},a),d=[],e=[];for(name in c.params)d.push(name+" = ?"),e.push(c.params[name]);var f=d.join(" AND ");this.db.transaction(function(a){a.executeSql("DELETE FROM "+c.table+" WHERE "+f,e,b)})},Database.prototype.getRows=function(a,b){var c=$.extend(null,{sql:"select * frome table",params:[]},a);this.db.transaction(function(a){a.executeSql(c.sql,c.params,b)})},Database.prototype.truncateTable=function(a,b){var c=$.extend(null,{size:500,table:"table",transaction:null},a);this.db.transaction(function(a){a.executeSql("DELETE FROM "+c.table+" WHERE timestamp NOT IN (SELECT timestamp FROM "+c.table+" ORDER BY timestamp LIMIT 0, ?)",[c.size],b)})};