Skip to content

Instantly share code, notes, and snippets.

@MRdNk
Last active December 11, 2015 22:28
Show Gist options
  • Save MRdNk/4669406 to your computer and use it in GitHub Desktop.
Save MRdNk/4669406 to your computer and use it in GitHub Desktop.
Example of the output with the new 'table' event emitter. For node.js - msnodesql

Table event listener

var stmt = sql.query(conn_str, "SELECT * from tbl1");
stmt.on('table', function (table) {
  console.log('table', table);
})

produces ...

table { 
  rows: [ 
      { id: 1, id2: 1, id3: 11, value: 'bob' }
    , { id: 3, id2: 2, id3: 12, value: 'fred' }
  ] 
}
My table columns are: id, id2, id3, value
And rows are:
0 = [1,1,11,'bob']
1 = [3,2,12,'fred']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment