-
-
Save JigarM/5067592 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get the collection object | |
Alloy.Collections.instance("Fugitive"); | |
// delete all items | |
Alloy.Collections.Fugitive.deleteAll(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.definition = { | |
config : { | |
"columns" : { | |
"name" : "TEXT", | |
"captured" : "integer", | |
"url" : "TEXT", | |
"capturedLat" : "real", | |
"capturedLong" : "real" | |
}, | |
"defaults" : { | |
"name" : "", | |
"captured" : 0, | |
"url" : "", | |
"capturedLat" : "", | |
"capturedLong" : "" | |
}, | |
"adapter" : { | |
"type" : "sql", | |
"collection_name" : "fugitives" | |
} | |
}, | |
extendModel : function(Model) { | |
_.extend(Model.prototype, { | |
}); | |
// end extend | |
return Model; | |
}, | |
extendCollection : function(Collection) { | |
_.extend(Collection.prototype, { | |
deleteAll : function() { | |
var collection = this; | |
var sql = "DELETE FROM " + collection.config.adapter.collection_name ; | |
db = Ti.Database.open(collection.config.adapter.db_name); | |
db.execute(sql); | |
db.close(); | |
} | |
}); | |
// end extend | |
return Collection; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment