I got a problem on webkit-sqlite adapter. It somehow saves the key
on a string format rather than integer. Indexed-db works just fine. It won't convert the key to string. Please see the code below.
var ppl = Lawnchair({adapter: 'webkit-sqlite', name:'people', record:'person'}, function(people) {
// anon fn bound to the instance
this.save({key:1, id:1, a:1, name:'nino'}, function(obj){
console.log(obj);
});
// anon fn bound to the instance
this.save({key:'2', id:2, a:2, name:'paolo'}, function(obj){
console.log(obj);
});
// get all the keys
this.keys(function(keys) {
console.log('keys:', keys);
});
// get 1
this.get(1, function(key) {
console.log('key:', key);
});
// get '2'
this.get('2', function(key) {
console.log('key:', key);
});
// we can also clear the entire collection w/ nuke
this.nuke()
});
Output:
undefined
Object {key: 1, id: 1, a: 1, name: "nino"}
Object {key: "2", id: 2, a: 2, name: "paolo"}
keys: ["1.0", "2"]
key: undefined
key: Object {key: "2", id: 2, a: 2, name: "paolo"}
Error:
See keys: ["1.0", "2"]
it supposed to be keys: [1, "2"]
Does anyone have patch for this?
Thanks.