mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 06:28:54 +00:00
update functions for 1.9.0, finally write prepare and common issues
This commit is contained in:
1 parent
c07dfc085c
commit
40dee21923
10 files changed
+227
-154
No files matched your search
@@ -0,0 +1,40 @@
|
||||
---
|
||||
title: fetchSingle
|
||||
---
|
||||
Returns the columns for a single row.
|
||||
|
||||
!!! info "Example"
|
||||
=== "Lua"
|
||||
**Callback**
|
||||
```lua
|
||||
MySQL.Async.fetchSingle('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
|
||||
if result then
|
||||
print(result.identifier, result.firstname, result.lastname)
|
||||
end
|
||||
end)
|
||||
```
|
||||
**Promise**
|
||||
```lua
|
||||
CreateThread(function()
|
||||
local result = MySQL.Sync.fetchSingle('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
|
||||
if result then
|
||||
print(result.identifier, result.firstname, result.lastname)
|
||||
end
|
||||
end)
|
||||
```
|
||||
=== "JavaScript"
|
||||
**Callback**
|
||||
```js
|
||||
exports.oxmysql.single_callback('SELECT * FROM users WHERE identifier = ?', [playerIdentifier], function(result) {
|
||||
if (result)
|
||||
console.log(result.identifier, result.firstname, result.lastname)
|
||||
})
|
||||
```
|
||||
**Promise**
|
||||
```js
|
||||
setImmediate(async () => {
|
||||
const result = await exports.oxmysql.single_async('SELECT * FROM users WHERE identifier = ?', [playerIdentifier]) {
|
||||
if (result)
|
||||
console.log(result.identifier, result.firstname, result.lastname)
|
||||
})
|
||||
```
|
||||
Reference in new issue
Block a user