Update mysql docs

This commit is contained in:
Linden committed 2022-03-04 10:08:32 +11:00
1 parent b912eec843
commit 0d2d82cfce
11 files changed
+137 -188

No files matched your search

+9 -11
View File
@@ -1,12 +1,9 @@
---
title: scalar
---
# Scalar
Returns the first column for a single row.
:::info Example
Lua
## Lua
**Callback**
### Callback
```lua
-- Alias: exports.oxmysql:scalar
-- Alias: MySQL.Async.fetchScalar
@@ -15,7 +12,8 @@ MySQL.scalar('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifi
print(firstname)
end)
```
**Promise**
### Promise
```lua
-- Alias: exports.oxmysql:scalar_async
-- Alias: MySQL.Sync.fetchScalar
@@ -26,19 +24,19 @@ CreateThread(function()
end)
```
JavaScript
## JavaScript
**Callback**
### Callback
```js
exports.oxmysql.scalar('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier], function(firstname) {
console.log(firstname)
})
```
**Promise**
### Promise
```js
(async () => {
const firstname = await exports.oxmysql.scalar_async('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier]) {
console.log(firstname)
})()
```
:::