node-mariasql icon indicating copy to clipboard operation
node-mariasql copied to clipboard

Added support for numeric parameters in Client#prepare()

Open krizalys opened this issue 8 years ago • 1 comments

Client#prepare() currently quotes numeric values and therefore forces the SQL engine to interpret them as strings.

However, some values, such as the one given to LIMIT or OFFSET, accept only numeric values.

For example, using MySQL 5.5:

SELECT * FROM city LIMIT '2';

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2'' at line 1

SELECT * FROM city LIMIT 2;

[...] 2 rows in set (0.00 sec)

This pull request modifies Client#prepare() so that it leaves Number values alone.

krizalys avatar Sep 02 '17 20:09 krizalys

Fixes #94 but noticed that https://github.com/mscdex/node-mariasql/pull/153 already attempted to fix it.

Merge whichever you want, as long as this is resolved :)

krizalys avatar Sep 02 '17 20:09 krizalys