refactor(sql)

This commit is contained in:
Mycroft
2021-04-06 19:58:41 +01:00
parent a64596ac3c
commit eb8152fc4f
2 changed files with 24 additions and 11 deletions
+1
View File
@@ -11,6 +11,7 @@ end)
-- This Code Was changed to fix error With player spawner as default --
-- Link to the post with the error fix --
-- https://forum.fivem.net/t/release-esx-kashacters-multi-character/251613/316?u=xxfri3ndlyxx --
Citizen.CreateThread(function()
while true do
Citizen.Wait(200)
+23 -11
View File
@@ -3,18 +3,30 @@
-- where identifiers are used (such as users, owned_vehicles, owned_properties etc.)
---------------------------------------------------------------------------------------
local IdentifierTables = {
{table = "addon_account_data", column = "owner"},
{table = "addon_inventory_items", column = "owner"},
{table = "billing", column = "identifier"},
{table = "datastore_data", column = "owner"},
{table = "owned_vehicles", column = "owner"},
{table = "owned_properties", column = "owner"},
{table = "rented_vehicles", column = "owner"},
{table = "users", column = "identifier"},
{table = "user_licenses", column = "owner"}
}
local IdentifierTables = {}
function GetTables()
MySQL.ready(function ()
MySQL.Async.fetchAll(" SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = 'owner'"}, function(result)
if result then
print(json.encode(result))
for k, v in pairs(result) do
table.insert( IdentifierTables, {table = v.TABLE_NAME, column = "owner"})
end
end
end)
MySQL.Async.fetchAll("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = 'identifier'"}, function(result)
if result then
print(json.encode(result))
for k, v in pairs(result) do
table.insert( IdentifierTables, {table = v.TABLE_NAME, column = "identifier"})
end
end
end)
end)
end
GetTables()
RegisterServerEvent("kashactersS:SetupCharacters")
AddEventHandler('kashactersS:SetupCharacters', function()
local src = source