mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 22:22:50 +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,34 @@
|
||||
---
|
||||
title: fetchScalar
|
||||
---
|
||||
Returns the first column for a single row.
|
||||
|
||||
!!! info "Example"
|
||||
=== "Lua"
|
||||
**Callback**
|
||||
```lua
|
||||
MySQL.Async.fetchScalar('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier}, function(firstname)
|
||||
print(firstname)
|
||||
end)
|
||||
```
|
||||
**Promise**
|
||||
```lua
|
||||
CreateThread(function()
|
||||
local firstname = MySQL.Async.fetchScalar('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier})
|
||||
print(firstname)
|
||||
end)
|
||||
```
|
||||
=== "JavaScript"
|
||||
**Callback**
|
||||
```js
|
||||
exports.oxmysql.scalar_callback('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier], function(firstname) {
|
||||
console.log(firstname)
|
||||
})
|
||||
```
|
||||
**Promise**
|
||||
```js
|
||||
(async () => {
|
||||
const firstname = await exports.oxmysql.scalar_async('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier]) {
|
||||
console.log(firstname)
|
||||
})()
|
||||
```
|
||||
Reference in new issue
Block a user