0

I guess node.js' mysql drivers are async, but I'm not really sure what that means, so... The npm module for node.js allows for rows to "stream" or be "gathered up all at once".

Can someone show me where streaming and gathering are applied, and can someone show me how a mysql_fetch_array()-like (from php) operation would be done in node.js?

Wolfpack'08
  • 3,982
  • 11
  • 46
  • 78

1 Answers1

0

"Streaming" means that you get a callback for each row, with an argument that's an object corresponding to the row. The other option gives you a callback after all the rows have been fetched, with an argument that's an array of objects, each element corresponding to one row. Which one to use depends on how your application logic is structured.

The latter one sounds like what you're looking for, though (again depending on your application logic) it might or might not be the best way to do it.

ebohlman
  • 14,795
  • 5
  • 33
  • 35
  • It's difficult for me to understand what you're saying without seeing examples. "In computer programming, a callback is a reference to a piece of executable code that is passed as an argument to other code. This allows a lower-level software layer to call a subroutine (or function) defined in a higher-level layer." - wiki. Not very useful because the definition is full of technical jargon, as well. Not that I don't appreciate the answer, but taking into account the number of references the reader has to go through to get to something they can understand: how many should we assume they will? – Wolfpack'08 Jul 30 '12 at 08:01
  • @Wolfpack'08 Did you get this solved? I'm trying to figure out this as well and I'd like to know if you ever got an solution? (yes I know it was 2 years ago it was asked, lol) – prk Mar 13 '14 at 18:35