From d293c0e4d5eacb2dc525066e879daf070173b5aa Mon Sep 17 00:00:00 2001 From: Niek Schoemaker <32094562+niekschoemaker@users.noreply.github.com> Date: Thu, 23 Jun 2022 14:21:14 +0200 Subject: [PATCH] Add known incompatibility between mysqljs and mysql2 --- docs/oxmysql/Getting Started/issues.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/oxmysql/Getting Started/issues.md b/docs/oxmysql/Getting Started/issues.md index daa49c85..e0e0b30d 100644 --- a/docs/oxmysql/Getting Started/issues.md +++ b/docs/oxmysql/Getting Started/issues.md @@ -12,3 +12,10 @@ Typically the result of failing to follow instructions. :::tip Solution Download the latest release _build_ (not source) of oxmysql, and ensure it is starting before any resources that require it. ::: + +### Numbers treated as string +This is an incompatibility between mysqljs (used by mysql-async) and mysql2 (used by oxmysql) (See [Known incompatibilities with node-mysql](https://github.com/sidorares/node-mysql2/tree/master/documentation#known-incompatibilities-with-node-mysql)) + +To resolve this issue simply add `&decimalNumbers=true` to the connection string, ie. `mysql://root@localhost/essentialmode?charset=utf8mb4_general_ci&decimalNumbers=true` to revert to the behavior of mysqljs. + +Do note with this that precision will be less with this, as Javascript treats all numbers as floats, so a double or decimal will be cast to a float this way. \ No newline at end of file