Webkit-sqlite 어댑터에 문제가 있습니다. 어떻게 든 정수가 아닌 문자열 형식으로 key
을 저장합니다. 인덱싱 된 db는 정상적으로 작동합니다. 키를 문자열로 변환하지 않습니다. 아래 코드를 참조하십시오.Lawnchair의 webkit-sqlite 어댑터가 key를 string으로 변환하는 이유는 무엇입니까?
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()
});
출력 :
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"}
오류 :
는이에 대한 누군가가 패치를 가지고 있습니까 keys: [1, "2"]
있어야 keys: ["1.0", "2"]
를 참조하십시오?
감사합니다.