mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-03 14:38:49 +00:00
new docs
This commit is contained in:
1 parent
3cebaf7fa5
commit
b5eba8423f
229 files changed
+6238
-10690
No files matched your search
@@ -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`
|
||||
Reference in new issue
Block a user