On Thursday, March 6, 2014 5:58:11 PM UTC-5, Bob Spero wrote:
>
> Here is what I am talking about, look at return select_statement, I 
> assign it the data but ss still comes back!
>
>
You're trying to return a value inside a callback, which is useless. What 
you need to do instead is add a callback parameter to `sql_file` and call 
the callback with the `data` value (or `error` if that is set) using the 
node callback style:

function sql_file(cb) {
  var fileName = "./SQLs/inventory.sql";
  fs.readFile(fileName, function(err, buffer) {
    if (err) return cb(err);
    return cb(null, buffer.toString());
  });
}

// use the function ...
sql_file(function(err, sqlstatement) {
  if (err) throw err;
  console.log('sql statement is: ' + sqlstatement);
});

-- 
-- 
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.

Reply via email to