ThymonA / fivem-mysql

MySQL library/resource made for FiveM. Fastest MySQL library for FiveM
GNU General Public License v3.0
16 stars 6 forks source link

SQL Syntax errors when using fivem-mysql #5

Closed Vicken52 closed 2 years ago

Vicken52 commented 3 years ago

I'm seeing these following errors across all of my resources when trying to startup fxserver with fivem-mysql: image

I updated all the resource.lua files with the following changes image Is there more that needs to be done to migrate from mysql-async to fivem-mysql that I might be missing?

ThymonA commented 3 years ago

Thanks for reporting this issue, it doesn't seems like it compatible anymore. The differents between those two are the way templates works. I will fix this in the feature, but for know I recommand to use mysql-async if you already using it.

mysql-async

--- Example `players`
MySQL.Async.fetchAll('SELECT * FROM `players` WHERE `identifier` = @identifier', {
    ['@identifier'] = 'steam:...'
}, function(results)
    print(json.encode(results))
end)

fivem-mysql

--- Example `players`
MySQL.Async.fetchAll('SELECT * FROM `players` WHERE `identifier` = :identifier', {
    ['identifier'] = 'steam:...'
}, function(results)
    print(json.encode(results))
end)

--- OR

mysql:fetchAllAsync('SELECT * FROM `players` WHERE `identifier` = :identifier', {
    ['identifier'] = 'steam:...'
}, function(results)
    print(json.encode(results))
end)
Vicken52 commented 3 years ago

I'll keep using mysql-async and wait for the fix before migrating over, thank you so much!