mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 22:22:46 +00:00
feat(mysql): start moving docs
This commit is contained in:
1 parent
ee76abb4db
commit
7f636ad7e7
11 files changed
+566
-1
No files matched your search
@@ -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)
|
||||
})()
|
||||
```
|
||||
Reference in new issue
Block a user