title: Transactions in nodejs
body: <p>i have 2 queries i want to execute inside a transaction
  rollback</p>
  
  <pre><code>var mysql = require('mysql');
  var connection = mysql.createConnection({
      host: "host",
      user: "user",
      password: "pass"
  });
  var query1 = "insert into table1 values (1,2,3)";
  var query2 = "update last_update set date=now()";
  connection.beginTransaction(function(err) {
          if (err) {
              throw err;
          } 
          connection.query(query1, function(err, result) {
                  if (err) {
                      connection.rollback(function() {
                          throw err;
                      });
                  }
                  });
          connection.query(query2, function(err, result) {
                  if (err) {
                      connection.rollback(function() {
                          throw err;
                      });
                  }
                  });           
    });
  </code></pre>
  
  <p>when i run this nothing happened no errors and the queries don't excecute </p>