Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple transactions #95

Open
amirjrn opened this issue Feb 15, 2021 · 2 comments
Open

Multiple transactions #95

amirjrn opened this issue Feb 15, 2021 · 2 comments

Comments

@amirjrn
Copy link

amirjrn commented Feb 15, 2021

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?

@amirjrn
Copy link
Author

amirjrn commented Feb 15, 2021

By the way I really do not need to use transaction in this case . Just need a simple query. Thanks

@trasherdk
Copy link

trasherdk commented Feb 15, 2021

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();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants