Hi Bob, setPrefetchRowCount(50) is only a hint. It tells the driver to fetch 50 records at a time instead of fetching them 1 by 1. It should only impact performance, not the actual result set that you get.
I saw your message on GitHub. I added the reader API to the driver and I may be able to help you but only after March 25 because I'm taking a break and I won't have my computer. Bruno. On Friday, March 14, 2014 10:10:36 AM UTC+1, Bob Spero wrote: > > 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.
