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

+77
View File
@@ -0,0 +1,77 @@
---
title: Single
---
import { Tab, Tabs } from 'nextra-theme-docs';
Returns all selected columns for a single row.
## Promise
<Tabs items={['Lua', 'JS']}>
<Tab>
```lua
local row = MySQL.single.await('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ? LIMIT 1', {
identifier
})
if not row then return end
print(row.firstname, row.lastname)
```
</Tab>
<Tab>
```js
const row = await MySQL.single('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ? LIMIT 1', [
identifier
])
if (!row) return;
console.log(row.firstname, row.lastname)
```
</Tab>
</Tabs>
**Aliases**
- `exports.oxmysql.single_async`
## Callback
<Tabs items={['Lua', 'JS']}>
<Tab>
```lua
MySQL.single('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ? LIMIT 1', {
identifier
}, function(row)
if not row then return end
print(row.firstname, row.lastname)
end)
```
</Tab>
<Tab>
```js
MySQL.single('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ? LIMIT 1', [
identifier
], (row) => {
if (!row) return;
console.log(row.firstname, row.lastname)
})
```
</Tab>
</Tabs>
**Aliases**
- `exports.oxmysql.single`