[Free] oxmysql - asynchronous MySQL wrapper

Why you change from “exports.oxmysql” to “MySQL.Async” or “MySQL.Sync” ?

This need alot of work for change

Use the included mysql lib.

You mean, in fxmanifest file add this?

server_scripts {
	'lib/MySQL.lua',
	'dist/server/build.js',
}

@oxmysql/lib/MySQL.lua

If i have scripts with older exports, if i put @oxmysql/lib/MySQL.lua on fxmanifest.lua will work ?

hi i am having a error of no such export is fetch and fetchSync can someone help me to solve this issue

Hello, they have been deprecated.

3 Likes

Good afternoon, I can’t replace such a construction, is it possible to get rid of the Async script? construction examples are as follows

Async.parallel(asyncTasks, function(results)
		cb(licenses)
end)

If you want to see an example how to execute query with multiple values.

Refer to es_extended/functions.lua at e544d03eaa81ffc943d7d63a8714c247dd1088a6 · overextended/es_extended · GitHub

“ER_ACCESS_DENIED_ERROR” - Use the correct login details.

what? no

I am new in lua, and i cant find how to make your script ready for oxmysl.

So can some one explain me maybe.

Do i need to edit this:

fxmanifest.lua

server_scripts {
'@async/async.lua',

'@mysql-async/lib/MySQL.lua',

To this:

server_scripts {
'@async/async.lua',
	
'@oxmysql/lib/MySQL.lua',

And the server/main.lua from this:

table.insert(tasks, function(cb)
		MySQL.Async.fetchAll('SELECT name, money FROM user_accounts WHERE identifier = @identifier', {
			['@identifier'] = player.getIdentifier()
		}, function(accounts)
			local validAccounts = ESX.Table.Set(Config.Accounts)
			for k,v in ipairs(accounts) do
				if validAccounts[v.name] then
					table.insert(userData.accounts, {
						name  = v.name,
						money = v.money,
						label = Config.AccountLabels[v.name]
					})
				end
			end

			cb()
		end)
	end)

To this:

	table.insert(tasks, function(cb)
		exports.oxmysql:fetch('SELECT name, money FROM user_accounts WHERE identifier = @identifier', {
			['@identifier'] = player.getIdentifier()
		}, function(accounts)
			local validAccounts = ESX.Table.Set(Config.Accounts)
			for k,v in ipairs(accounts) do
				if validAccounts[v.name] then
					table.insert(userData.accounts, {
						name  = v.name,
						money = v.money,
						label = Config.AccountLabels[v.name]
					})
				end
			end

			cb()
		end)
	end)

1 Like

MySQL.query(‘SELECT * from users WHERE identifier = ?’, {identifier}), function(result)
– callback response
– same as MySQL.Async.fetchAll
end)

exports.oxmysql:fetch is used for javascript

also can you go through the documentation here : GitHub - overextended/oxmysql: MySQL resource for FX Server

1 Like

You don’t need to change anything, oxmysql has a backwards compatible library and provides for mysql-async (so long as you don’t still have its folder).

Hello friends, when I enter the server, I encounter the following error and stay on the Awating scripts. Someone can help me. thank you

That’s not oxmysql first at first.

Check esx_skin installation folder (execute .sql file inside it)

1 Like

Thank you very much. It was fixed

Same problem here, and i am 100% sure that the connection string is correct!



what to do here ?

Do you still have a mysql-async folder? It conflicts.