rewrite oxmysql docs

This commit is contained in:
Linden committed 2023-05-31 21:23:24 +10:00
1 parent 864a1b3858
commit 3298244c9a
17 files changed
+630 -520

No files matched your search

+21 -18
View File
@@ -1,24 +1,27 @@
# Common Issues
---
title: Common issues
---
### Unable to establish a connection
## Unable to establish a connection
This is usually the result of incorrect database settings or your password containing reserved characters (`; , / ? : @ & = + $ #`).
:::tip Solution
Ensure you have entered the correct database settings in the mysql_connection_string convar.
You can try using the semicolon-separated format if your password contains reserved characters.
This is usually the result of incorrect database settings or your password containing reserved characters.
`; , / ? : @ & = + $ #` are reserved.
:::info
Ensure you have entered the correct database settings in the `mysql_connection_string` convar. You can try using the
semicolon-separated format if your password contains reserved characters.
:::
### No such export ... in resource oxmysql
## No such export ... in resource oxmysql
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.
- Download the latest release _build_ (not the source code) of oxmysql.
- Ensure it is starting before any resources that require it.
## Numbers treated as string
To resolve this issue simply enable `decimalNumbers` in your connection string, ie. `mysql://root@localhost/essentialmode?decimalNumbers=true`.
:::caution
JavaScript treats all numbers as floats, so a double or decimal value will be cast as a float with this setting.
Numbers will have less precision when this setting is enabled.
:::
### 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.