Query results are udefined
Does this make sense, I am attempting to get the deptname from dept, the trace looks right with SELECT count(*) as count FROM depts t0 WHERE t0.groupname = :1 [ 'warehouse' ], when I run this direct in sql developer I get the right results but if I log console.log(count) I get undefined. Am I returning the results properly?
var persist = require("persist"); var type = persist.type;
dept = persist.define('ALERT', { 'id': type.INTEGER, 'deptname': type.STRING });
persist.connect({ "driver": "oracle", "hostname": "127.0.0.1", "database": "hr", "user": "user", "password": "password", trace: true },
function(err, connection) {
alert.where('deptname = ?', 'warehouse').count(connection, function(err, count) {
console.log(count);
});
});
Try adding this in your count callback:
if(err) console.log(err)
To ensure you don't have a hidden error happening (you should probably do that for your connection callback as well - it has helped me immensely while trying to use this library