Closed korgon closed 10 years ago
you are right .. damn it me, I should have put a test for that. Thanks for the report
test in place, behavior as described. let me know if latest is OK and eventually feel free to close this, thanks :-)
Thanks for the quick fix and the awesome module.
This is not working for me (v0.8.22). I tried using this functionality and it failed with an error. So I decided to just take the example code listed here and run it, the same error occurred. This is the code I ran:
var dblite = require('dblite'), db = dblite(':memory:');
db.query('CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY, value TEXT)'); db.query('INSERT INTO test VALUES(null, ?)', ['some text']); db.query('SELECT * FROM test');
db.query('INSERT INTO test VALUES(?, ?)', [ 123, {name: 'dblite', rate: 'awesome'} // value serialized ]);
// use the fields to parse back the object db.query('SELECT * FROM test WHERE id = ?', [123], { id: Number, value: JSON.parse // value unserialized }, function (rows) { var record = rows[0]; console.log(record.id); // 123 console.log(record.value.name); // "dblite" console.log(record.value.rate); // "awesome"" });
Produced this error:
/home/node/webs/node_modules/dblite/build/dblite.node.js:692 "'" + what.replace(SINGLE_QUOTES, SINGLE_QUOTES_DOUBLED) + "'" ^ TypeError: Object #