Skip to content

Example of getting metadata

Tom Conlon edited this page Dec 7, 2015 · 1 revision

Add a third parameter to your db.query callback. e.g.

     exports.runQuery = function(sql, cb) {
        // Get a free pool
        pool.get(function(err, db) {

           if (err)
              ut.logError(err);
           else {
              db.query(sql, function(err, rs, meta) {
                 console.log(err);
                 db.detach(); // IMPORTANT: release the pool db
                 cb(err, rs, meta);
              });
           }
        });

        pool.destroy();
     };