Files
overextended.github.io/docs/oxmysql/Usage/scalar.md
T
2022-03-04 10:08:32 +11:00

920 B

Scalar

Returns the first column for a single row.

Lua

Callback

-- Alias: exports.oxmysql:scalar
-- Alias: MySQL.Async.fetchScalar

MySQL.scalar('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier}, function(firstname)
	print(firstname)
end)

Promise

-- Alias: exports.oxmysql:scalar_async
-- Alias: MySQL.Sync.fetchScalar

CreateThread(function()
	local firstname = MySQL.scalar.await('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier})
	print(firstname)
end)

JavaScript

Callback

exports.oxmysql.scalar('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier], function(firstname) {
    console.log(firstname)
})

Promise

(async () => {
  const firstname = await exports.oxmysql.scalar_async('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier]) {
    console.log(firstname)
})()