mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 22:21:48 +00:00
* refactor: Add h1 headers to all pages missing it * refactor: missed example h3 * change hooks example heading to bold text --------- Co-authored-by: Luke <[email protected]>
76 lines
1.2 KiB
Plaintext
76 lines
1.2 KiB
Plaintext
---
|
|
title: scalar
|
|
---
|
|
|
|
import { Tab, Tabs } from 'nextra-theme-docs';
|
|
|
|
# Scalar
|
|
|
|
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`
|