dom adapter adds lawnchair name to keys #57

Closed
jimfulton opened this Issue Aug 26, 2011 · 1 comment

Comments

Projects
None yet
2 participants

When objects with keys are saved and then loaded, the loaded objects
have the lawnchair name as a prefix:

db = new Lawnchair({name: 'xxx'}, function() {})
Lawnchair
db.save({key:'3', a: 1})
Lawnchair
db.get('3', function (o) {console.log(o.key)})
xxx.3
Lawnchair

This isn't true for the webkit-sqlite or the memory adapter.

Bonus:

The keys returned from get can't be used in subsequent gets:

db = new Lawnchair({name: 'xxx'}, function() {})
Lawnchair
db.save({key:'3', a: 1})
Lawnchair
db.get('3', function (o) {console.log(o.key)})
xxx.3
Lawnchair
db.get('xxx.3', function (o) {console.log(o)})
null
Lawnchair
db.get('3', function (o) {console.log(o.key)})
xxx.3
Lawnchair

If they key returned from get is used in a save, the lawnchair name is
added again:

db.save({key:'xxx.3', a: 1})
Lawnchair
db.get('xxx.3', function (o) {console.log(o.key)})
xxx.xxx.3
Lawnchair

brianleroux added a commit that referenced this issue Sep 23, 2011

Merge pull request #62 from niallsmart/master
Fixes issue #57 & #59. THANK YOU!!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment