title: How can I pass scope to a callback in node-mysql?
body: <p>I get a <code>client is not defined</code> error out of the following code:</p>
  
  <pre><code>var mysql = require('mysql');
  var conf = {
    'database':'database',
    'user':'user',
    'password':'password'
  };
  
  function mysqlQuery(mysql, conf, query, callback) {
    var client = mysql.createClient({
      user:conf.user,
      password:conf.password
    });
    client.query('USE ' + conf.database, function () {
      client.query(query, callback);
    });
  }
  
  mysqlQuery(
    mysql,
    conf,
    'SELECT * FROM users;',
    function selectCb(err, results) {
      if (err) {
        throw err;
      }
      console.log(results);
      client.end();
    }
  );
  </code></pre>
  
  <p>How can I pass the client variable to my callback function? I have no control on how the callback function will be called as it is called by the mysql module.</p>