[Release] vSql - MySQL Async Library

That’s hell yeah fast on some point!
Could you give me some example of sql request to make sure I understand every thing and I will definitely use it!

Congrats on this new release @Warxander
However, have you compared this with the ghmattimysql resource for FiveM that actually does support transactions?

If you have done any research/benchmarking, that is :open_mouth:

Just check sql-test, there are all kind of queries.

OOh got it ! Ty

Not sure what i’m doing wrong, for exemple this one

vSql.Async.execute("UPDATE owned_vehicles SET state ="..state.." WHERE plate="..plate.."",nil, function(data)end)

No error on console, but the value state is not changed

Is there an equivalent for MySQL.ready? Or when do I know, that MySQL is ready to be used?

It’s always ready to use, just make sure to start it before your resources :slight_smile:

Is there a way I can use “mysql.ready”? Or how to replace.

When I start the server I get an “attempt to index a nil value (global ‘MySQL’)” error.

how do i run it with Mysql.Ready some scripts are required for it.
BTW, This is amazing.

EX:

MySQL.ready(function()
	vSql.Async.fetchAll('SELECT * FROM shops LEFT JOIN items ON items.name = shops.item', {}, function(shopResult)
		for i=1, #shopResult, 1 do
			if shopResult[i].name then
				if ShopItems[shopResult[i].store] == nil then
					ShopItems[shopResult[i].store] = {}
				end

				if shopResult[i].limit == -1 then
					shopResult[i].limit = 30
				end

				table.insert(ShopItems[shopResult[i].store], {
					label = shopResult[i].label,
					item  = shopResult[i].item,
					price = shopResult[i].price,
					limit = shopResult[i].limit
				})
			else
				print(('esx_shops: invalid item "%s" found!'):format(shopResult[i].item))
			end
		end
	end)
end)

Citizen.CreateThread(function()
	MySQL.ready(function()
		vSql.Async.fetchAll("SELECT identifier,next_collect FROM `daily_free`",{},function(data)
			for k,v in ipairs(data) do
				timecache[v.identifier]=v.next_collect
			end
		end)
	end)
end)

Looks like you forgot to add server_script "@vSql/vSql.lua" to your __resource.lua file…

Make sure that this line is actually executing (add logs before and inside callback function).

I added it.
But it doesn’t work, it doesn’t work.



error


When I change to “vSql.ready”

Same here for Mysql.Ready.
How does this work for MySQL.Sync?

I use vSql.Sync.

My server.cfg

vSql 1.3

  • Add vSql.ready for compatibility

Please note, that it WILL NOT WORK if your resources initialization order is wrong.
Place start vSql before other resources, which are using it!

Binaries: https://github.com/warxander/vSql/releases/tag/v1.3

Sync mode is not supported, avoid using it because it’s VERY SLOW.

vSql.ready were added in 1.3
Sync mode is not supported, read above.

Use latest version (1.3) and replace all occurrences with vSql.ready.

nice work ! is there any monitoring system in-game - or some logs maybe for slow Queries ?

Good idea, I will think about it for a future release.