serverless-mysql
serverless-mysql copied to clipboard
Multiple transactions
trafficstars
Hello . Thank you for your nice package!
I want to do a multipe query transaction like below:
DB.query('INSERT into t.billing (name , lastname ) VALUES ('amir' , 'jiryan');
UPDATE t_billing.transactions
Set deposit = 0,
final = 1,
_lmb = 27
WHERE id = 625');
but getting syntax error . Can you please provide the solution?
By the way I really do not need to use transaction in this case . Just need a simple query. Thanks
Something like:
let result = await mysql
.query( 'INSERT into t.billing (name , lastname ) VALUES ( ? , ? )', [ fname, lname ] )
.query( 'UPDATE t_billing.transactions Set deposit = 0, final = 1, _lmb = 27 WHERE id = 625' )
.catch( e => {
/* do something with error */
})
.end();