I've just started using Lawnchair's Query plugin and I cannot seem to get the query syntax to work with a parametised argument in the where() clause.
var store = new Lawnchair('store', function() {
});
store.nuke();
// save some data
store.batch([{a:"abc"},{a:2},{a:2},{a:"def"},{a:4}], function() {
});
// query (works)
store.where("record.a === 2", function(results) {
alert('got ' + results.length + ' results');
});
// query (works)
store.where("record.a === 'abc'", function(results) {
alert('got ' + results.length + ' results');
});
// Uncaught ReferenceError: abc is not defined
store.where("record.a === ?", 'abc', function(results) {
alert('got ' + results.length + ' results');
});
// Works but does not return any results
store.where("record.a === ?", "'abc'", function(results) {
alert('got ' + results.length + ' results');
});
I believe I'm doing this as per the Lawnchair unit tests.