This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 15th, 2013  |  syntax: JavaScript  |  size: 0.35 KB  |  views: 32  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. function doQuery(query) {
  2.     return pool.getConnectionAsync().then(function(connection) {
  3.         return connection.queryAsync(query)
  4.             .finally(function(){
  5.                 connection.release();
  6.             });
  7.     });
  8. }
  9.  
  10. //don't have to worry about closing connection
  11. doQuery("SELECT * FROM table").spread(function(rows, fields){
  12.  
  13. });
clone this paste RAW Paste Data