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

Add some parameter type checking for prepared statements #353

Closed
wants to merge 5 commits into from

Conversation

kevinmartin
Copy link

Whenever I use anything besides Types.DECIMAL for number type, I get Error: Incorrect arguments to mysqld_stmt_execute.

Related to: #348

Whenever I use anything besides `Types.DECIMAL` for number type, I get `Error: Incorrect arguments to mysqld_stmt_execute`.

Related to: sidorares#348
Prevents an error when `CONCAT(?)` is used.
if (this.parameters instanceof Date) {
packet.writeInt16(Types.DATETIME);
} else if (
Array.isArray(this.parameter[i]) ||
Copy link
Owner

@sidorares sidorares Jul 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo here s/paramerer/parameters/

@sidorares
Copy link
Owner

Thanks @kevinmartin !
Could you add a test ( with execute + number + string + array + date parameters ) ?

@kevinmartin
Copy link
Author

Any guidance?

@sidorares
Copy link
Owner

Unfortunately mysql server version on TravisCI does not support json ( maybe this can be overriden, but right now .travis.yml uses default setup ). Maybe you add simple select with parameters, using at least numeric and string parameter types
Test examples:
https://github.com/sidorares/node-mysql2/blob/master/test/integration/connection/test-execute-newdecimal.js
https://github.com/sidorares/node-mysql2/blob/master/test/integration/connection/test-execute-null-bitmap.js
https://github.com/sidorares/node-mysql2/blob/master/test/integration/connection/test-execute-signed.js

Actually it looks like it's already covered ( with exception for JSON case ) Maybe you add your original JSON test, but wrap it with a sql check to execute only when JSON type supported?

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

Successfully merging this pull request may close these issues.

2 participants