Your problem is that you're running a non-blocking call. So temp is still going to be an empty object until the db call returns.
Here's what you want to do:
var db = new sqlite3.Database(config.sqlite3config.path),
temp;
statement = db.prepare("SELECT * FROM test_table");
statement.get(function(err, col) {
temp = col;
console.log(temp);
});
There's no reason to set temp to an empty object, because col will be overriding it anyway, so just declare it as a variable and you'll be good. What I would do would be to not even set temp, and just use col.
but if you absolutely need to do it the way you did you might want to do it a hack-ey way and set a timeout:
db = new sqlite3.Database(config.sqlite3config.path);
statement = db.prepare("SELECT * FROM test_table");
var temp = {};
statement.get(function(err, col) {
temp = col;
});
setTimeout(function () {
console.log(temp);
}, 20);
The problem with doing it this way is that you have no idea when the return will get back if at all.