mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 06:28:54 +00:00
Wrap Sync exports in CreateThread/setImmediate
This commit is contained in:
1 parent
9af6205bb7
commit
2c2f4e0661
5 files changed
+59
-39
No files matched your search
+11
-7
@@ -15,10 +15,12 @@ Updates an entry in the database and returns the number of affected rows.
|
||||
```
|
||||
**Sync**
|
||||
```lua
|
||||
local id = exports.oxmysql:insertSync('UPDATE users SET firstname = ? WHERE identifier = ? ', {newName, playerIdentifier})
|
||||
if affectedRows then
|
||||
print(affectedRows)
|
||||
end
|
||||
CreateThread(function()
|
||||
local id = exports.oxmysql:insertSync('UPDATE users SET firstname = ? WHERE identifier = ? ', {newName, playerIdentifier})
|
||||
if affectedRows then
|
||||
print(affectedRows)
|
||||
end
|
||||
end)
|
||||
```
|
||||
=== "JavaScript"
|
||||
**Async**
|
||||
@@ -30,7 +32,9 @@ Updates an entry in the database and returns the number of affected rows.
|
||||
```
|
||||
**Sync**
|
||||
```js
|
||||
const id = exports.oxmysql.insertSync('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier]) {
|
||||
if (affectedRows)
|
||||
console.log(affectedRows)
|
||||
setImmediate(async () => {
|
||||
const id = exports.oxmysql.insertSync('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier]) {
|
||||
if (affectedRows)
|
||||
console.log(affectedRows)
|
||||
})
|
||||
```
|
||||
Reference in new issue
Block a user