Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
executeQuery: function(sql, options){
// executes a query with provide start and end parameters, calculating the total number of rows
if(options){
if(typeof options.start === "number"){
var countSql = sql.replace(/select.*?from/i,"SELECT COUNT(*) as count FROM");
if(typeof options.end === "number"){
sql += " LIMIT " + (options.end - options.start + 1);
}
sql += " OFFSET " + options.start;
var results = this.executeSql(sql, options.parameters).rows;
var lengthObject = first(this.executeSql(countSql, options.parameters).rows);
results.totalCount = lengthObject.count;
return results;
}
}
var results = this.executeSql(sql, options.parameters).rows;
results.totalCount = results.length;
return results;
},
getSchema: function(){
get: function(id){
var object = first(store.executeSql("SELECT * FROM " + config.table + " WHERE " + config.idColumn + "=?", [id]).rows);
if(object){
defineProperty(object.__proto__ = {
getId: function(object){
return this[config.idColumn];
}
}, "getId", {enumerable: false});
}
return object;
},
"delete": function(id){