mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-01 22:21:51 +00:00
rename update to execute
This commit is contained in:
1 parent
eef4b7bdf9
commit
6cf83ac4d1
1 file changed
+2
-2
@@ -0,0 +1,41 @@
|
||||
---
|
||||
title: execute
|
||||
---
|
||||
Returns the number of affected rows by the query.
|
||||
|
||||
!!! info "Example"
|
||||
=== "Lua"
|
||||
**Callback**
|
||||
```lua
|
||||
MySQL.Async.update('UPDATE users SET firstname = ? WHERE identifier = ? ', {newName, playerIdentifier}, function(affectedRows)
|
||||
if affectedRows then
|
||||
print(affectedRows)
|
||||
end
|
||||
end)
|
||||
```
|
||||
**Promise**
|
||||
```lua
|
||||
CreateThread(function()
|
||||
local id = MySQL.Sync.update('UPDATE users SET firstname = ? WHERE identifier = ? ', {newName, playerIdentifier})
|
||||
if affectedRows then
|
||||
print(affectedRows)
|
||||
end
|
||||
end)
|
||||
```
|
||||
|
||||
=== "JavaScript"
|
||||
**Callback**
|
||||
```js
|
||||
exports.oxmysql.update_callback('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier], function(affectedRows) {
|
||||
if (affectedRows)
|
||||
console.log(affectedRows)
|
||||
})
|
||||
```
|
||||
**Promise**
|
||||
```js
|
||||
setImmediate(async () => {
|
||||
const id = exports.oxmysql.update_async('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier]) {
|
||||
if (affectedRows)
|
||||
console.log(affectedRows)
|
||||
})
|
||||
```
|
||||
Reference in new issue
Block a user