Is anyone familiar with this package
https://github.com/joeferner/node-oracle<https://github.com/joeferner/node-oracle>?
It is the plugin that allows you to interact with oracle. On the website
it provides an example for you to connect to a database and set the rownum
with setPrefetchRowCount. So I took the example filled in my database
connection and it works but I never make it to console.log("all records
processed"). The second you add any other console.log to the code it will
make it to "all records processed" BUT the setPrefetchRowCount no longer
works it pulls every record out. I am convinced there is a semi colon
missing somewhere in the example but my debugging skill are limited at
best, I have only been working with node for about a week now.
Thanks for the help!
var oracle = require('oracle');
var connectData = {
hostname: "127.0.0.1",
port: 1521,
database: "xe", // System ID (SID)
user: "user",
password: "password"};
oracle.connect(connectData, function(err, connection) {
if (err) {
console.log("Error connecting to db:", err);
return;
}
connection.setPrefetchRowCount(50);
var reader = connection.reader("SELECT * FROM CARS", []);
function doRead(cb) {
reader.nextRow(function(err, row) {
if (err) return cb(err);
if (row) {
// do something with row
console.log("got " + JSON.stringify(row));
// recurse to read next record
return doRead(cb)
} else {
// we are done
return cb();
}
});
}
doRead(function(err) {
if (err) throw err; // or log it
console.log("all records processed");
});
});
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.