This commit is contained in:
Luke committed 2023-06-04 15:15:21 +02:00
1 parent 3cebaf7fa5
commit b5eba8423f
229 files changed
+6238 -10690

No files matched your search

+74
View File
@@ -0,0 +1,74 @@
---
keywords: ['scalar', 'fetchScalar']
title: Scalar
---
import { Tab, Tabs } from 'nextra-theme-docs';
Returns the first column for a single row.
## Promise
<Tabs items={['Lua', 'JS']}>
<Tab>
```lua
local firstName = MySQL.scalar.await('SELECT `firstname` FROM `users` WHERE `identifier` = ? LIMIT 1', {
identifier
})
print(firstName)
```
</Tab>
<Tab>
```js
const firstName = await MySQL.scalar('SELECT `firstname` FROM `users` WHERE `identifier` = ? LIMIT 1', [
identifier
])
console.log(firstName)
```
</Tab>
</Tabs>
**Aliases**
- `MySQL.Sync.fetchScalar`
- `exports.ghmattimysql.scalar`
- `exports.oxmysql.scalar_async`
## Callback
<Tabs items={['Lua', 'JS']}>
<Tab>
```lua
MySQL.scalar('SELECT `firstname` FROM `users` WHERE `identifier` = ? LIMIT 1', {
identifier
}, function(firstName)
print(firstName)
end)
```
</Tab>
<Tab>
```js
MySQL.scalar('SELECT `firstname` FROM `users` WHERE `identifier` = ? LIMIT 1', [
identifier
], (firstName) => {
console.log(firstName)
})
```
</Tab>
</Tabs>
**Aliases**
- `MySQL.Async.fetchScalar`
- `exports.ghmattimysql.scalar`
- `exports.oxmysql.scalar`