Q: Node-Mysql Transaction rollback not working js as well as mysql. I'm in trouble with transactions.
In the function below i did exactly as they said here https://github.com/mysqljs/mysql#transactions. But its not working :|  
function insertMemoTransaction(){
  pool.getConnection(function(error, connection){
    if(error){
      alert("Somthing is wrong with your connection");
    }
    connection.beginTransaction(function(error){
      if(error) { throw error; }
      var idfield = scope.find('input[name="Party_Id"]');
      var Party_Id;
      if(idfield.val() == '-1'){
        var newParty = {
          // An object
        };
        connection.query("INSERT INTO ?? SET ?",['Party', newParty],function(error, result, fields){
          if(error){
            return connection.rollback(function(){
              throw error;
            });
          }
          else{
            Party_Id = result.insertId;
            var infoObj = {
              // an Object
            }


            connection.query('INSERT INTO ?? SET ?', ['Memo_Info', infoObj], function(error, result, fields){
              if(error){
                return connection.rollback(function(){
                  throw error;
                });
              }
            });
          }
        });
      }
      else{
        Party_Id = idfield.val();
        var infoObj = {
          // an Object
        }

        connection.query('INSERT INTO ?? SET ?', ['Memo_Info', infoObj], function(error, result, fields){
          if(error){
            return connection.rollback(function(){
              throw error;
            });
          }
        });
      }
      connection.commit(function(error) {
        if (error) { 
          return connection.rollback(function() {
            throw error;
          });
        }
        console.log('Transaction Complete.');
        connection.release();
      });
    });
  });
}

I wrote this piece of code to make a transaction in node-mysql, But if,
 connection.query('INSERT INTO ?? SET ?', ['Memo_Info', infoObj], function(error, result, fields)

This query doesn't run Somehow, Affect of 
connection.query("INSERT INTO ?? SET ?",['Party', newParty],function(error, result, fields)

This one doesn't roll back.
[I've set autocommit = 0]

A: Gotcha #1
Check which engine your tables are using:
show table status;

If your table in question is set to MyISAM, you've found the problem. MyISAM does not support transactions and thus cannot be rolled back. You can alter the table to use InnoDB as the engine to fix the issue:
ALTER TABLE table_name ENGINE = InnoDB;

or set it when the table is created:
CREATE TABLE table_name (
...
) ENGINE = InnoDB;


Gotcha #2
If you're using a pooled connection, make sure your rollback query is using the same connection.
Calling pool.query() isn't guaranteed to use the same connection, though it may seem to during development and testing.
See the docs for pool.getConnection() to make it work.
