mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 14:38:50 +00:00
75 lines
1.2 KiB
Plaintext
75 lines
1.2 KiB
Plaintext
---
|
|
keywords: ['execute']
|
|
title: Update
|
|
---
|
|
|
|
import { Tab, Tabs } from 'nextra-theme-docs';
|
|
|
|
Returns the number of rows affected by the query.
|
|
|
|
## Promise
|
|
|
|
<Tabs items={['Lua', 'JS']}>
|
|
<Tab>
|
|
|
|
```lua
|
|
local affectedRows = MySQL.update.await('UPDATE users SET firstname = ? WHERE identifier = ?', {
|
|
newName, identifier
|
|
})
|
|
|
|
print(affectedRows)
|
|
```
|
|
|
|
</Tab>
|
|
<Tab>
|
|
|
|
```js
|
|
const affectedRows = await MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ?', [
|
|
newName, identifier
|
|
])
|
|
|
|
console.log(affectedRows)
|
|
```
|
|
|
|
</Tab>
|
|
</Tabs>
|
|
|
|
**Aliases**
|
|
|
|
- `MySQL.Sync.execute`
|
|
- `exports.ghmattimysql.executeSync`
|
|
- `exports.oxmysql.update_async`
|
|
|
|
## Callback
|
|
|
|
<Tabs items={['Lua', 'JS']}>
|
|
<Tab>
|
|
|
|
```lua
|
|
MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ?', {
|
|
newName, identifier
|
|
}, function(affectedRows)
|
|
print(affectedRows)
|
|
end)
|
|
```
|
|
|
|
</Tab>
|
|
<Tab>
|
|
|
|
```js
|
|
MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ?', [
|
|
newName, identifier
|
|
], (affectedRows) => {
|
|
console.log(affectedRows)
|
|
})
|
|
```
|
|
|
|
</Tab>
|
|
</Tabs>
|
|
|
|
**Aliases**
|
|
|
|
- `MySQL.Async.execute`
|
|
- `exports.ghmattimysql.execute`
|
|
- `exports.oxmysql.update`
|