Skip to content

Help with nested queries #2311

Closed Answered by sidorares
BinaryVigilante asked this question in Q&A
Discussion options

You must be logged in to vote

Why is that necessary when it can be done without the use of promises and async using sqlite without issues

likely your driver exposes synchronous api. mysql2 is built on top of node net functionality and only provides async interface.

Is there a workaround so I don't have to use async and promises?

you could try
https://www.npmjs.com/package/sync-mysql

or wrap your code as an executable script and call it with execSync
I'd imagine performance is going to be much worse with sync versions

Is the above code supposed to work or am I doing something wrong?

pass your parameters as an array: databaseConnection.query("INSERT INTO table (row1, row2) VALUES (?,?)", row1,row2, (err) => {. Sin…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by BinaryVigilante
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2310 on December 07, 2023 01:58.