Using Node.js 4.2.1 with sqlite3 3.1.1 The following code -
var sqlitedb = new sqlite3.Database(sqliteFilename);
sqlitedb.serialize(function() {
sqlitedb.run("SELECT ZDATA FROM ZMYTABLE;", function(err, rows) {
console.log(rows);
});
});
sqlitedb.close();
Prints undefined in the console, but if the same query is executed using the sqlite3 tool, it works fine -
$ sqlite3 backup.sqlite
SQLite version 3.8.10.2 2015-05-20 18:17:19
Enter ".help" for usage hints.
sqlite> SELECT ZDATA FROM ZMYTABLE;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
...
Any idea why SQL returns undefined rows in Node.js?