Hope can support such function like below
var conn = yield mysql.createConnection(cfg);
yield conn.execute('begin'); // or yield conn.startTransaction();
but when I tried these code. I got error 'This command is not supported in the prepared statement protocol yet'.
yes, you can't use transactions with prepared statements.
you should be able to use yield conn.startTransaction(); with code from master ( landed in #531, not in npm yet ) or just yeld conn.query('start transaction') - beginTransaction() does exactly the same under the hood
Thanks @sidorares , yield conn.query('start transaction') works for me.
Most helpful comment
yes, you can't use transactions with prepared statements.
you should be able to use
yield conn.startTransaction();with code from master ( landed in #531, not in npm yet ) or justyeld conn.query('start transaction')- beginTransaction() does exactly the same under the hood