feat(mysql): start moving docs

This commit is contained in:
N-fire committed 2022-03-02 13:20:06 +01:00
1 parent ee76abb4db
commit 7f636ad7e7
11 files changed
+566 -1

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
---
title: scalar
---
Returns the first column for a single row.
!!! info "Example"
=== "Lua"
**Callback**
```lua
-- Alias: exports.oxmysql:scalar
-- Alias: MySQL.Async.fetchScalar
MySQL.scalar('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier}, function(firstname)
print(firstname)
end)
```
**Promise**
```lua
-- 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**
```js
exports.oxmysql.scalar('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier], function(firstname) {
console.log(firstname)
})
```
**Promise**
```js
(async () => {
const firstname = await exports.oxmysql.scalar_async('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier]) {
console.log(firstname)
})()
```