Skip to content
This repository was archived by the owner on Jul 14, 2020. It is now read-only.

Commit b2d670a

Browse files
GHMattiGHMatti
GHMatti
authored and
GHMatti
committed
Update readme
1 parent 8f55651 commit b2d670a

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

README.md

+29-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
# MySQL Async Library for FiveM
1+
# mysql-async Library for FiveM
22

3-
This library intends to provide function to connect to a MySQL library in a Sync and Async Way.
3+
This library intends to provide function to connect to a MySQL library in a Sync and Async way.
44

5-
## Disclaimer
5+
## Table of Contents
6+
* [Installation](#installation)
7+
* [Configuration](#configuration)
8+
* [keepAlive](#keepalive)
9+
* [ConVars](#convars)
10+
* [GUI](#gui)
11+
* [Usage](#usage)
12+
* [Features](#features)
613

7-
This mod does not replace EssentialMode, it offers instead a way of connecting to MySQL from lua-scripts, but
8-
it will never contain any gameplay logic. It will remain a simple wrapper around MySQL functions.
9-
10-
All feedback is appreciated in order to deliver a stable release.
1114

1215
## Installation
1316

@@ -26,13 +29,26 @@ Add this convar to your server configuration and change the values according to
2629

2730
`set mysql_connection_string "server=localhost;uid=mysqluser;password=password;database=fivem"`
2831

29-
### Alternatively mysql.js connection string
30-
31-
Support for this connection string will be dropped if 3.2 hits.
32+
Alternatively an url-like connection string can be used:
3233

3334
`set mysql_connection_string "mysql://username:password@host/database"`
3435

35-
Further options can be found under https://github.com/mysqljs/mysql#connection-options for the mysql.js connection string
36+
Further options can be found under https://github.com/mysqljs/mysql#connection-options for the mysql.js connection string, they can be added on both: the semicolon seperated string or the url-like string.
37+
38+
### keepAlive
39+
40+
For people, having issues with the connection being interrupted for usually a bad network configuration, but have no way of figuring out what is wrong, there is an option to enable keep alive queries. This will execute a query on the given interval. To enable those keep alive queries, append e.g. `keepAlive=60` to your connection string, seperated with a semicolon, to ensure that a keep alive query is fired every 60s.
41+
42+
### ConVars
43+
44+
The following ConVars are available in the `server.cfg` which you execute. These have also to be set before `start mysql-async`
45+
* `set mysql_debug 1`: Prints out the actual consumed query.
46+
* `set mysql_debug_output "console"`: Select where to output the log, accepts `console`, `file`, and `both`. In case of `both` and `file` a file named `mysql-async.log` in your main server folder will be created.
47+
* `set mysql_slow_query_warning 200`: Sets a limit in ms, queries slower than this limit will be displayed with a warning at the specified location of `mysql_debug_output`, see above.
48+
49+
## GUI
50+
51+
Since the newest version, anyone with ace admin rights can open the GUI by typing `mysql` in the F8 console. This opens a profiling view of the data collected by this middleware, that might help you optimize resources and queries. You can disable the viewing of certain data by clicking on the respective entry in the legends, and can browse a table of the 21 slowest performing queries.
3652

3753
## Usage
3854

@@ -115,7 +131,7 @@ local countPlayer = MySQL.Sync.fetchScalar("SELECT COUNT(1) FROM players")
115131

116132
## Features
117133

118-
* Async / Sync
134+
* Async / Sync.
119135
* It uses the https://github.com/mysqljs/mysql library to provide a connection to your mysql server.
120136
* Create and close a connection for each query, the underlying library use a connection pool so only the
121-
mysql auth is done each time, old tcp connections are keeped in memory for performance reasons
137+
mysql auth is done each time, old tcp connections are keeped in memory for performance reasons.

0 commit comments

Comments
 (0)