Good work ! the script is great
Updated (node.js version)
- The node.js version is now an release candidate. If there are not any feature requests, I will move it to full release in a week from now. Meaning the old C#-based connector will be archived.
- All kinks with the variable input have been solved.
- Mostly docs should be missing which Iâll be writing in the next 7 days.
About mysql_connection_string
- I am also very sorry to announce that a
ghmattimysql
wonât be able to take a connection string maybe until release. Compared to mysql-async, the resource is ready to go as soon as the exports are loaded, and not whenonServerResourceStart
fires. But currently Convars cannot be read until these events fire; which would mean awaiting until this has happened, but since you cannot await it on the top level in javascript at the moment, I would have to add an Promise to wait until the pool has been established. - I have not decided yet if I want the connection string option in the library, but I am open for convincing.
Huh? That shouldnât be the case and most definitely isnât.
Maybe ask around before making odd conclusions and posting them publicly as if theyâre truth.
console.log(global.GetConvar('mysql_connection_string', 'default'));
will always default unless run after onResourceStart
. I added
set mysql_connection_string "hey world!"
this time definetely to the correct server.cfg
; although I am on the 760 server version.
Just tried it, and you seem to be wrong, even on 760.
Output:
Started resource scoreboard
Started resource playernames
hey world!
Started resource myresource
__resource.lua:
server_script 'hi.js'
hi.js contains your console.log call.
server.cfg:
# ///
set mysql_connection_string "hey world!"
start myresource
Maybe you tried to start the resource before the convar was set? .cfg
files arenât a map of settings, theyâre a script file, as evidenced by the fact theyâre run using +exec
which literally is called exec.
idd i am. i put it to the other convars in the server.cfg
with the default ones from https://docs.fivem.net/server/#server-cfg which is afaik common practice and way down from the start
block. then I am smarter again. thanks a lot.
Perhaps the example should be updated to spread resource starts around randomly to highlight this fact.
Or prehaps I should deal with this issue for ghmattimysql by documenting that the vars belong before the start command.
Update
We are now at rc.1, the script now takes convars if they are above the start of the script e.g.:
set mysql_connection_string "mysql://mysqluser:password@localhost/test?dateStrings=true"
start ghmattimysql
and the config.json
is missing.
Update to rc.3
execute uses now the standard query, when no prepared statement according to the mysql/mariadb syntax is found. The one with the ?
.
This would cause issues and possible slow downs otherwise.
great resource
Updated
- @justcfx2u fixed the old returning friend of the not null from scalars.
- The old query style is now translated into the new one, so that prepared statements are used.
Keep up the great work
Its compatibility with ESX jobs?
Definately no. It uses a completely different command set than mysql-async.
To make it work you would have to change the commands one by one.
Also you cannot use it on linux at the moment, for some reason v8 in linux is not garbage collecting properly and executing stuff properly (got freezes on certain sql commands) and out of memory crashes.
Does this reproduce even if you donât use outdated server builds but build your own/use the Docker builds?
disregard that. I confused folders.
Would u say this is faster than Mysql-Async?
It is, but it does not matter. The mysql-async node variant is fast enough. It should handle without any issues 1500 queries per second. Whereas most servers run maybe 100-300 or so?