[Release] MySQL Async Library - 3.3.2

Thanks , I need to replace in essential mode ?

1 Like

Nope, you need to add function in you own code. Do not touch to essential mod and again in your code you have to replace the “GetplayersFromid” exemple :

AddEventHandler('mod:event', function()
	TriggerEvent('es:getPlayerFromId', source, function(user)
		local player = user.identifier
		--your code
	end)
end)

by

AddEventHandler('mod:event', function()
	local player = getPlayerID(source)
	--your code
end)

For some reason you must keep it if you call the add/remove money cause it’s a part of essentialmode.

But it’s not an issue of Mysql Async Library, it’s just an issues in your code.

1 Like


i can not figure out where this problem is located in the code.

1 Like

I need some help, I am clearly not understanding something. I have followed the instructions on how to install the async libary but every time i replace “require “resources/essentialmode/lib/MySQL”” with “require “resources/mysql-async/lib/MySQL”” it comes up with these errors on every single script i have and they dont work.

Then i asked Vodkhard (He made a inventory system) why and he said not all scripts need that only the ones that require Async but when i then do that and change the scripts that originally require “resources/essentialmode/lib/MySQL”" back to that. they dont work.

Please help this is bugging my mind. :slight_smile:

Your Issue with your code is somewhere in server.lua for the resource whitelistdb and its either on or begins at line 5

By the looks of it your issue is because the Async Library opens a connection to the table differently compared to the original MySQL library that came with essential mode. Hope this helps

Not having enough time ATM to look at the table:open problem, but certainly other libs where depending on the connection provided by essentialmod which is not publicly available anymore (or at least not in the same manner), will look at this mode later (cannot give you an ETA, just when i got time :slight_smile: )

By the way for those wondering, i’m already working on fxserver to have this lib working, right now it’s working for the async functions, and trying to convert sync function using async api with coroutines, but no success ATM.

I will try to push a new version with fxserver and legacy server compatible scripts

(Don’t worry API should not change with 0.2.2)

Why?

Why what? Change the time it auto kills in the clean/clear script.

Which plug-in to modify?

Remove mysql-async from your plugin if you don’t want to auto kill connections that are sleeping for more than 10 secs, it doesn’t do anything beside that when you add this mod in the list.

As this is a lib not a mod, and so you don’t need to add it to your citmp-server.yml file just require the file that your need to make mysql requests.

i forgot to add one line. thanks

So i’ve been trying to wrap my head around this all day, i have pretty good knowledge of mySQL, but im pretty new to lua.

i pretty much understand all the examples, but i don’t understand how you’d go about changing something like this
 https://pastebin.com/nFLNKUqJ

If someone would be kind enough to show me how/what to do it would be greatly appreciated.

how would I get the row count from a query?

need some help can anybody have the essential mode on async I been trying to convert and having problems


Hello, I’m having some issue with async request, i’m trying to moove but i have much error,

here my old request :

function checkIsTow(identifier)
	local query = MySQL:executeQuery("SELECT * FROM repairman WHERE identifier = '@identifier'", { ['@identifier'] = identifier})
	local result = MySQL:getResults(query, {'rank'}, "identifier")
	
	if(not result[1]) then
		TriggerClientEvent('repairman:receiveIsTow', source, "inconnu")
	else
		TriggerClientEvent('repairman:receiveIsTow', source, result[1].rank)
	end
end

here the new one (maybe i did some error):


function checkIsTow(identifier)
	MySQL.Async.fetchAll("SELECT * FROM repairman WHERE identifier = @identifier", { ['@identifier'] = identifier}, function (result)
	if(not result[1]) then
		TriggerClientEvent('repairman:receiveIsTow', source, "inconnu")
	else
		TriggerClientEvent('repairman:receiveIsTow', source, result[1].rank)
	end
end)

Hi,

Thanks for this resources but for all my resources the ‘@identifier’ will not replace 
 You know why ?

can you show us your code where this is located please.

why do i get this error everytime i try to load a resource that uses mysql

https://gyazo.com/74c05e26a8bb466ef77d98385e809edd

So I can’t use essential mode on my hosted server cause I can’t install couchdb on it.
Am I supposed to use this alongside a 2.0 version of essential mode? I change all the scripts and stuff, upgrade them, make them require the lib but it doesn’t do anything.