Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL Update #20

Merged
merged 1 commit into from
Jan 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ local function hasCraftItems(source, CostItems, amount)
end

local function IsVehicleOwned(plate)
local result = exports.oxmysql:scalarSync('SELECT 1 from player_vehicles WHERE plate = ?', {plate})
local result = MySQL.Sync.fetchScalar('SELECT 1 from player_vehicles WHERE plate = ?', {plate})
if result then return true else return false end
end

Expand Down Expand Up @@ -68,7 +68,7 @@ end
-- Stash Items
local function GetStashItems(stashId)
local items = {}
local result = exports.oxmysql:scalarSync('SELECT items FROM stashitems WHERE stash = ?', {stashId})
local result = MySQL.Sync.fetchScalar('SELECT items FROM stashitems WHERE stash = ?', {stashId})
if result then
local stashItems = json.decode(result)
if stashItems then
Expand Down Expand Up @@ -101,7 +101,7 @@ local function SaveStashItems(stashId, items)
for slot, item in pairs(items) do
item.description = nil
end
exports.oxmysql:insert('INSERT INTO stashitems (stash, items) VALUES (:stash, :items) ON DUPLICATE KEY UPDATE items = :items', {
MySQL.Async.insert('INSERT INTO stashitems (stash, items) VALUES (:stash, :items) ON DUPLICATE KEY UPDATE items = :items', {
['stash'] = stashId,
['items'] = json.encode(items)
})
Expand Down Expand Up @@ -189,7 +189,7 @@ end
-- Trunk items
local function GetOwnedVehicleItems(plate)
local items = {}
local result = exports.oxmysql:scalarSync('SELECT items FROM trunkitems WHERE plate = ?', {plate})
local result = MySQL.Sync.fetchScalar('SELECT items FROM trunkitems WHERE plate = ?', {plate})
if result then
local trunkItems = json.decode(result)
if trunkItems then
Expand Down Expand Up @@ -222,7 +222,7 @@ local function SaveOwnedVehicleItems(plate, items)
for slot, item in pairs(items) do
item.description = nil
end
exports.oxmysql:insert('INSERT INTO trunkitems (plate, items) VALUES (:plate, :items) ON DUPLICATE KEY UPDATE items = :items', {
MySQL.Async.insert('INSERT INTO trunkitems (plate, items) VALUES (:plate, :items) ON DUPLICATE KEY UPDATE items = :items', {
['plate'] = plate,
['items'] = json.encode(items)
})
Expand Down Expand Up @@ -310,7 +310,7 @@ end
-- Glovebox items
local function GetOwnedVehicleGloveboxItems(plate)
local items = {}
local result = exports.oxmysql:scalarSync('SELECT items FROM gloveboxitems WHERE plate = ?', {plate})
local result = MySQL.Sync.fetchScalar('SELECT items FROM gloveboxitems WHERE plate = ?', {plate})
if result then
local gloveboxItems = json.decode(result)
if gloveboxItems then
Expand Down Expand Up @@ -343,7 +343,7 @@ local function SaveOwnedGloveboxItems(plate, items)
for slot, item in pairs(items) do
item.description = nil
end
exports.oxmysql:insert('INSERT INTO gloveboxitems (plate, items) VALUES (:plate, :items) ON DUPLICATE KEY UPDATE items = :items', {
MySQL.Async.insert('INSERT INTO gloveboxitems (plate, items) VALUES (:plate, :items) ON DUPLICATE KEY UPDATE items = :items', {
['plate'] = plate,
['items'] = json.encode(items)
})
Expand Down Expand Up @@ -1396,7 +1396,7 @@ RegisterNetEvent('inventory:server:SetInventoryData', function(fromInventory, to
end)

RegisterNetEvent('qb-inventory:server:SaveStashItems', function(stashId, items)
exports.oxmysql:insert('INSERT INTO stashitems (stash, items) VALUES (:stash, :items) ON DUPLICATE KEY UPDATE items = :items', {
MySQL.Async.insert('INSERT INTO stashitems (stash, items) VALUES (:stash, :items) ON DUPLICATE KEY UPDATE items = :items', {
['stash'] = stashId,
['items'] = json.encode(items)
})
Expand Down