Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 15th, 2013  |  syntax: JavaScript  |  size: 0.38 KB  |  views: 4  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. pool.getConnectionAsync().then(function(connection) {
  2.     //Use `connection` to do query
  3.     connection.queryAsync("SELECT * FROM table").spread(function(rows, fields){
  4.         //Handle successful query
  5.     })
  6.     .catch(function(e) {
  7.         //Handle error
  8.     })
  9.         //In either case, release connection
  10.     .finally(function(){
  11.         connection.release();
  12.     })
  13. });
clone this paste RAW Paste Data