mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 14:38:50 +00:00
add rawExecute
This commit is contained in:
1 parent
185a0826eb
commit
5321a62529
8 files changed
+81
-13
No files matched your search
@@ -1,6 +1,5 @@
|
||||
---
|
||||
keywords: ['execute', 'insert']
|
||||
title: Insert
|
||||
title: insert
|
||||
---
|
||||
|
||||
import { Tab, Tabs } from 'nextra-theme-docs';
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
---
|
||||
title: Prepare
|
||||
title: prepare
|
||||
---
|
||||
|
||||
import { Tab, Tabs } from 'nextra-theme-docs';
|
||||
|
||||
The only function that provides true prepared statements, granting native protection and query planning by MySQL.
|
||||
Prepare can be used to execute frequently called queries faster and accepts multiple sets of parameters to be used with a single query.
|
||||
|
||||
- Date will not return the datestring commonly used in FiveM
|
||||
- TINYINT 1 and BIT will not return a boolean
|
||||
- You can only use ? value placeholders, ?? column placeholders and named placeholders will throw an error
|
||||
|
||||
When using SELECT, the return value will match `query`, `single`, or `scalar` depending on the number of columns and rows selected.
|
||||
Unlike [rawExecute](../rawExecute), the SELECT statement will return a column, row, or array of rows depending on the number of columns and rows selected.
|
||||
|
||||
## Promise
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
---
|
||||
keywords: ['fetchAll', 'execute']
|
||||
title: Query
|
||||
title: query
|
||||
---
|
||||
|
||||
import { Tab, Tabs } from 'nextra-theme-docs';
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
import { Tab, Tabs } from 'nextra-theme-docs';
|
||||
|
||||
rawExecute can be used to execute frequently called queries faster and accepts multiple sets of parameters to be used with a single query.
|
||||
|
||||
- Date will not return the datestring commonly used in FiveM
|
||||
- TINYINT 1 and BIT will not return a boolean
|
||||
- You can only use ? value placeholders, ?? column placeholders and named placeholders will throw an error
|
||||
|
||||
Unlike [prepare](../prepare), the SELECT statement will always return an array of rows.
|
||||
When using SELECT, the return value will match `query`, `single`, or `scalar` depending on the number of columns and rows selected.
|
||||
|
||||
## Promise
|
||||
|
||||
<Tabs items={['Lua', 'JS']}>
|
||||
<Tab>
|
||||
|
||||
```lua
|
||||
local response = MySQL.rawExecute.await('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ?', {
|
||||
identifier
|
||||
})
|
||||
|
||||
|
||||
print(json.encode(response, { indent = true, sort_keys = true }))
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab>
|
||||
|
||||
```js
|
||||
const response = await MySQL.rawExecute('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ?', [
|
||||
identifier
|
||||
])
|
||||
|
||||
console.log(JSON.stringify(response))
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
**Aliases**
|
||||
|
||||
- `exports.oxmysql.rawExecute_async`
|
||||
|
||||
## Callback
|
||||
|
||||
<Tabs items={['Lua', 'JS']}>
|
||||
<Tab>
|
||||
|
||||
```lua
|
||||
MySQL.rawExecute('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ?', {
|
||||
identifier
|
||||
}, function(response)
|
||||
print(json.encode(response, { indent = true, sort_keys = true }))
|
||||
end)
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab>
|
||||
|
||||
```js
|
||||
MySQL.rawExecute('SELECT `firstname`, `lastname` FROM `users` WHERE `identifier` = ?', [
|
||||
identifier
|
||||
], (response) => {
|
||||
console.log(JSON.stringify(response))
|
||||
})
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
**Aliases**
|
||||
|
||||
- `exports.oxmysql.rawExecute`
|
||||
@@ -1,6 +1,5 @@
|
||||
---
|
||||
keywords: ['scalar', 'fetchScalar']
|
||||
title: Scalar
|
||||
title: scalar
|
||||
---
|
||||
|
||||
import { Tab, Tabs } from 'nextra-theme-docs';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Single
|
||||
title: single
|
||||
---
|
||||
|
||||
import { Tab, Tabs } from 'nextra-theme-docs';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Transaction
|
||||
title: transaction
|
||||
---
|
||||
|
||||
import { Tab, Tabs } from 'nextra-theme-docs';
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
---
|
||||
keywords: ['execute']
|
||||
title: Update
|
||||
title: update
|
||||
---
|
||||
|
||||
import { Tab, Tabs } from 'nextra-theme-docs';
|
||||
|
||||
Reference in new issue
Block a user