ghmattimysql
A mysql middleware for fivem
A brief overview, why and how?
First there was mysql-async (which I am maintaining now too), written in C#. Due to the current mono-limitations several issues arose:
- Everything was executed on the main server threadpool, meaning that the server might start to hitch on longrunning queries that were not async.
- Async continuitation after awaiting was only possible at the next server tick, leading to slow reads.
- Which became even slower because the buffer used was affected by the underlying mono issue.
This lead to me creating GHMattiMySQL in C#, which executed queries in synchronous mode on different threads from the server thread pool, which in turn to tackle these issues as properly as possible. And it worked.
But then node.js picked up on FiveM, and the mysql protocol middleware for node, was suffering none of these issues. So I decided to move both projects: mysql-async and ghmattimysql to node.js.
If you are looking for the old C# version to see how it tackled the problem then look below (or if you are using vRP):
Why are still two implementations needed? Well since mysql-async targets more towards the a large amount of people using it and needs to be fully backwards compatible, this cripples the syntax of the mysql.js implementation and many of its functions and is solely thought for the usage in lua.
ghmattimysql instead still aims to be mostly backwards compatible, but will include some breaking changes every now and then to aim for the easier use, better performance.
Download
To download the latest version, follow the link to the releases of the github repository.
Documentation
To read up on how to install, configure and use this resource follow this link to the Documentation.
The node.js version breaks with the naming of exports due to the preferral of using the node.js mysql names