formatting and typos

This commit is contained in:
DokaDoka committed 2022-12-11 15:00:43 +11:00
1 parent 75698216e0
commit 724c7e356d
99 files changed
+515 -305

No files matched your search

+9 -5
View File
@@ -1,16 +1,19 @@
# Benchmark
Internal benchmark
```
```md
Low: 0.1222ms | Avg: 0.14188357ms | Total: 1418.8357ms (10000 queries)
```
Round-trip-time for exports
```
```md
Low: 0.1997ms | Avg: 0.25898800ms | Total: 2589.8800ms (10000 queries)
```
#### Lua (5.4)
## Lua (5.4)
```lua
local val = 10000
RegisterCommand('luasync', function()
@@ -38,7 +41,8 @@ RegisterCommand('luasync', function()
end)
```
#### JavaScript
## JavaScript
```js
const val = 10000
RegisterCommand('jssync', async() => {
@@ -60,4 +64,4 @@ RegisterCommand('jssync', async() => {
console.log(result)
console.log('Low: '+ queryMsLow +'ms | Avg: '+averageQueryTime+'ms | Total: '+queryMsSum+'ms ('+queryTimesLocal.length+' queries)')
})
```
```
+10 -12
View File
@@ -31,23 +31,21 @@ Reference the following for an idea of how to set your connection options.
You must include one of the following lines, adjusted for your connection and database settings.
:::caution
When using convars do not replicate sensitive information to the client.
When using convars do not replicate sensitive information to the client.
**set** will only be set on the server, while **setr** is replicated.
:::
```
```yaml
set mysql_connection_string "mysql://root:12345@localhost:3306/es_extended?charset=utf8mb4"
set mysql_connection_string "user=root;password=12345;host=localhost;port=3306;database=es_extended;charset=utf8mb4"
```
Certain special characters are reserved or blocked and may cause issues when used in your password.
Certain special characters are reserved or blocked and may cause issues when used in your password.
For more optional settings (such as multiple statements) you can reference [pool.d.ts](https://github.com/sidorares/node-mysql2/blob/master/typings/mysql/lib/Pool.d.ts#L10) and [connection.d.ts](https://github.com/sidorares/node-mysql2/blob/master/typings/mysql/lib/Connection.d.ts#L8).
You can also add the following convars if you require extra information when testing queries.
```json
```yaml
set mysql_slow_query_warning 150
set mysql_debug true
```
@@ -56,7 +54,7 @@ set mysql_debug true
When using the `mysql_debug` convar, rather than setting the value as true, you can send an array and enable debug prints for a set list of resources instead.
```json
```yaml
set mysql_debug [
"ox_core",
"ox_inventory"
@@ -65,7 +63,7 @@ set mysql_debug [
This list can be adjusted during runtime with commands, temporarily adding or removing resources until the resource is restarted.
```
```yaml
oxmysql_debug remove ox_core
oxmysql_debug add ox_core
```
@@ -74,7 +72,7 @@ oxmysql_debug add ox_core
Before using the UI first you have to make sure you have the `mysql_ui` convar set to true:
```json
```yaml
set mysql_ui true
```
@@ -83,14 +81,14 @@ Also make sure that you have `command` ace permission access, then you should be
## Compatibility
You shouldn't run multiple mysql resources to ensure the best experience.
You shouldn't run multiple mysql resources to ensure the best experience.
The resources listed below can be deleted to allow oxmysql to handle the events, without any changes.
### mysql-async
Standard API for mysql-async uses `server_script '@mysql-async/lib/MySQL.lua'`.
Standard API for mysql-async uses `server_script '@mysql-async/lib/MySQL.lua'`.
Raw exports, mostly used in resources written in JavaScript or C#, are _not supported_.
### ghmattimysql
As of v2.4.0, oxmysql can be utilised with ghmattimysql's exports, such as `exports.ghmattimysql:execute`.
As of v2.4.0, oxmysql can be utilised with ghmattimysql's exports, such as `exports.ghmattimysql:execute`.
+5 -2
View File
@@ -1,21 +1,24 @@
# Common Issues
### 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.
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
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.
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.
+1 -1
View File
@@ -2,7 +2,7 @@
This allows queries to be properly prepared and escaped; the following lines are equivalent.
```
```lua
"SELECT group FROM users WHERE identifier = ?", {identifier}
"SELECT group FROM users WHERE identifier = :identifier", {identifier = identifier}
"SELECT group FROM users WHERE identifier = @identifier", {['@identifier'] = identifier}