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

[Bug] Multiple statement execution fails using common nodejs drivers #47060

Open
2 of 3 tasks
mikeburgh opened this issue Jan 16, 2025 · 0 comments
Open
2 of 3 tasks

[Bug] Multiple statement execution fails using common nodejs drivers #47060

mikeburgh opened this issue Jan 16, 2025 · 0 comments

Comments

@mikeburgh
Copy link

Search before asking

  • I had searched in the issues and found no similar issues.

Version

2.1.7

What's Wrong?

If you execute multiple statements in one batch

select 1; select 2;

The node drivers (mysql2, mariadb) only return the 2nd select's result.

What You Expected?

Both result sets to be returned.

How to Reproduce?

Run the following nodejs code

import mysql from "mysql2/promise";

async function main() {
	// Create the connection to database
	const connection = await mysql.createConnection({
		host: "localhost",
		port: 9030,
		user: "root",
		password: "",
		database: "mysql",
	});

	// A simple SELECT query
	try {
		const [results, fields] = await connection.query(`select 1; select 2;`);
		console.log(results); // results contains rows returned by server
		console.log(fields); // fields contains extra meta data about results, if available
	} catch (err) {
		console.log(err);
	}
}

main();

Anything Else?

The mysql2 driver outputs the following warnings in the above example:

Warning: got packets out of order. Expected 1 but received 5
Warning: got packets out of order. Expected 2 but received 6
Warning: got packets out of order. Expected 3 but received 7
Warning: got packets out of order. Expected 4 but received 8
Warning: got packets out of order. Expected 5 but received 9

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

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

1 participant