Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query results are udefined #96

Open
RobertZito opened this issue Mar 16, 2014 · 1 comment
Open

Query results are udefined #96

RobertZito opened this issue Mar 16, 2014 · 1 comment

Comments

@RobertZito
Copy link

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);
    });
});
@ioneyed
Copy link

ioneyed commented Mar 31, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants