I am using Lawnchair JavaScript library. Reference here http://westcoastlogic.com/lawnchair/
In below code, because i passed different id, TABLE1 and TABLE2.. I expect dao1 and dao2 are completely be stored as 2 different objects / storage. But the fact is they're referring to the same thing.. and any "save" action from dao1 or dao2, will be stored at the same "Lawnchair".
i.e. (dao1.all and dao2.all will return same array).
Appreciate for your big/small idea / suggestion.. Thanks!!
<script src="javascripts/lib/Lawnchair.js" type="text/javascript"></script>
<script src="javascripts/lib/adaptors/WebkitSQLiteAdaptor.js" type="text/javascript"></script>
<script src="javascripts/lib/adaptors/DOMStorageAdaptor.js" type="text/javascript"></script>
<script src="javascripts/lib/adaptors/LawnchairAdaptorHelpers.js" type="text/javascript"></script>
var dao1 = new Lawnchair('TABLE1');
dao1.nuke(); // Clear persistent storage.
dao1.save({111: '222'});
var dao2 = new Lawnchair('TABLE2');
dao2.nuke(); // Clear persistent storage.
dao2.save({333: '444'});
dao1.all(function(a) {
console.log("dao1")
console.log(a)
});
dao2.all(function(a) {
console.log("dao2")
console.log(a)
});
will produce something like below in Java Console
dao1
m-account.js:112[
Object
333: "444"
key: "ACF3A299-E986-4993-915F-A62FF009E846"
__proto__: Object
]
m-account.js:116
dao2
m-account.js:117[
Object
333: "444"
key: "ACF3A299-E986-4993-915F-A62FF009E846"
proto: Object
Lawnchair works fine:
I think you might be checking the wrong things (i.e. array length rather than contents), or putting one object in two Lawnchair databases, or perhaps you're not including all of the Lawnchair JavaScript files (there are several in my jsfiddle and I had to pull that list out of one of the Lawnchair examples).