This commit is contained in:
Linden committed 2023-05-23 02:16:59 +10:00
1 parent daf6a505fc
commit d2753fb2fd
10 files changed
+47 -10

No files matched your search

@@ -1,3 +1,7 @@
---
keywords: ['hasitem']
---
Get the total item count for all items in the player's inventory with the given name and metadata. Get the total item count for all items in the player's inventory with the given name and metadata.
```lua ```lua
@@ -1,3 +1,7 @@
---
keywords: ['hasitem']
---
import Tabs from '@theme/Tabs'; import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem'; import TabItem from '@theme/TabItem';
+13
View File
@@ -1,3 +1,16 @@
---
keywords: [
'addGlobalObject'
'addGlobalPed'
'addGlobalPlayer'
'addGlobalVehicle'
'removeGlobalObject'
'removeGlobalPed'
'removeGlobalPlayer'
'removeGlobalVehicle',
]
---
Registers options that will apply to all entities of that type (object, ped, player, vehicle). Registers options that will apply to all entities of that type (object, ped, player, vehicle).
```lua ```lua
+4
View File
@@ -1,3 +1,7 @@
---
keywords: ['execute', 'insert']
---
# Insert # Insert
Inserts a new entry into the database and returns the insert id for the row, if valid. Inserts a new entry into the database and returns the insert id for the row, if valid.
-2
View File
@@ -15,7 +15,6 @@ When using SELECT, the return value will match `query, single, or scalar` depend
```lua ```lua
-- alias: exports.oxmysql:prepare -- alias: exports.oxmysql:prepare
-- alias: MySQL.Async.prepare
MySQL.prepare('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result) MySQL.prepare('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
if result then if result then
@@ -28,7 +27,6 @@ end)
```lua ```lua
-- alias: exports.oxmysql:prepare_async -- alias: exports.oxmysql:prepare_async
-- alias: MySQL.Sync.prepare
local result = MySQL.prepare.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}) local result = MySQL.prepare.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
if result then if result then
+6 -2
View File
@@ -1,3 +1,7 @@
---
keywords: ['execute', 'fetchall']
---
# Query # Query
Generic function that can be utilised for any query. Generic function that can be utilised for any query.
@@ -9,7 +13,7 @@ When selecting data it will return all matching rows and columns, otherwise it w
```lua ```lua
-- alias: exports.oxmysql:query -- alias: exports.oxmysql:query
-- alias: MySQL.Async.query -- alias: MySQL.Async.fetchAll
-- alias: exports.ghmattimysql:execute -- alias: exports.ghmattimysql:execute
MySQL.query('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result) MySQL.query('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
@@ -26,7 +30,7 @@ end)
```lua ```lua
-- alias: exports.oxmysql:query_async -- alias: exports.oxmysql:query_async
-- alias: MySQL.Sync.query -- alias: MySQL.Sync.fetchAll
-- alias: exports.ghmattimysql:executeSync -- alias: exports.ghmattimysql:executeSync
local result = MySQL.query.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}) local result = MySQL.query.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
+4
View File
@@ -1,3 +1,7 @@
---
keywords: ['scalar', 'fetchscalar']
---
# Scalar # Scalar
Returns the first column for a single row. Returns the first column for a single row.
-2
View File
@@ -8,7 +8,6 @@ Returns the columns for a single row.
```lua ```lua
-- alias: exports.oxmysql:single -- alias: exports.oxmysql:single
-- alias: MySQL.Async.fetchSingle
MySQL.single('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(row) MySQL.single('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(row)
if row then if row then
@@ -21,7 +20,6 @@ end)
```lua ```lua
-- alias: exports.oxmysql:single_async -- alias: exports.oxmysql:single_async
-- alias: MySQL.Sync.fetchSingle
local row = MySQL.single.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}) local row = MySQL.single.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
if row then if row then
+4
View File
@@ -1,3 +1,7 @@
---
keywords: ['transaction']
---
# Transaction # Transaction
A transaction executes multiple queries and commits them only if all succeed. If one fails, none of the queries are committed. The return value is a `boolean`, which is the result of the transaction. A transaction executes multiple queries and commits them only if all succeed. If one fails, none of the queries are committed. The return value is a `boolean`, which is the result of the transaction.
+8 -4
View File
@@ -1,3 +1,7 @@
---
keywords: ['execute']
---
# Update # Update
Returns the number of affected rows by the query. Returns the number of affected rows by the query.
@@ -40,9 +44,9 @@ end
MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier], (affectedRows) => { MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier], (affectedRows) => {
if (affectedRows) { if (affectedRows) {
console.log(affectedRows) console.log(affectedRows);
} }
}) });
``` ```
### Promise ### Promise
@@ -50,8 +54,8 @@ MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, p
```js ```js
// alias: exports.oxmysql.update_async // alias: exports.oxmysql.update_async
const id = MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier]) const id = MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier]);
if (affectedRows) { if (affectedRows) {
console.log(affectedRows) console.log(affectedRows);
} }
``` ```