mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 22:21:48 +00:00
1 parent
5850640094
commit
8ca3c1bdfc
21 files changed
+190
-7
No files matched your search
@@ -9,6 +9,7 @@ Inserts a new entry into the database and returns the insert id for the row, if
|
||||
```lua
|
||||
-- alias: exports.oxmysql:insert
|
||||
-- alias: MySQL.Async.insert
|
||||
-- alias: exports.ghmattimysql:execute
|
||||
|
||||
MySQL.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', {playerIdentifier, firstName, lastName}, function(id)
|
||||
print(id)
|
||||
@@ -20,6 +21,7 @@ end)
|
||||
```lua
|
||||
-- alias: exports.oxmysql:insert_async
|
||||
-- alias: MySQL.Sync.insert
|
||||
-- alias: exports.ghmattimysql:executeSync
|
||||
|
||||
local id = MySQL.insert.await('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', {playerIdentifier, firstName, lastName})
|
||||
print(id)
|
||||
|
||||
@@ -10,6 +10,7 @@ When selecting data it will return all matching rows and columns, otherwise it w
|
||||
```lua
|
||||
-- alias: exports.oxmysql:query
|
||||
-- alias: MySQL.Async.query
|
||||
-- alias: exports.ghmattimysql:execute
|
||||
|
||||
MySQL.query('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
|
||||
if result then
|
||||
@@ -26,6 +27,7 @@ end)
|
||||
```lua
|
||||
-- alias: exports.oxmysql:query_async
|
||||
-- alias: MySQL.Sync.query
|
||||
-- alias: exports.ghmattimysql:executeSync
|
||||
|
||||
local result = MySQL.query.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
|
||||
if result then
|
||||
|
||||
@@ -9,6 +9,7 @@ Returns the first column for a single row.
|
||||
```lua
|
||||
-- alias: exports.oxmysql:scalar
|
||||
-- alias: MySQL.Async.fetchScalar
|
||||
-- alias: exports.ghmattimysql:scalar
|
||||
|
||||
MySQL.scalar('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier}, function(firstname)
|
||||
print(firstname)
|
||||
@@ -20,6 +21,7 @@ end)
|
||||
```lua
|
||||
-- alias: exports.oxmysql:scalar_async
|
||||
-- alias: MySQL.Sync.fetchScalar
|
||||
-- alias: exports.ghmattimysql:scalarSync
|
||||
|
||||
local firstname = MySQL.scalar.await('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier})
|
||||
print(firstname)
|
||||
|
||||
@@ -22,6 +22,7 @@ local queries = {
|
||||
```lua
|
||||
-- alias: exports.oxmysql:transaction
|
||||
-- alias: MySQL.Async.transaction
|
||||
-- alias: exports.ghmattimysql:transaction
|
||||
|
||||
MySQL.transaction(queries, function(success)
|
||||
print(success)
|
||||
@@ -33,6 +34,8 @@ end)
|
||||
```lua
|
||||
-- alias: exports.oxmysql:transaction_async
|
||||
-- alias: MySQL.Sync.transaction
|
||||
-- alias: exports.ghmattimysql:transactionSync
|
||||
|
||||
local success = MySQL.transaction.await(queries)
|
||||
print(success)
|
||||
```
|
||||
|
||||
@@ -9,6 +9,7 @@ Returns the number of affected rows by the query.
|
||||
```lua
|
||||
-- alias: exports.oxmysql:update
|
||||
-- alias: MySQL.Async.execute
|
||||
-- alias: exports.ghmattimysql:execute
|
||||
|
||||
MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ?', {newName, playerIdentifier}, function(affectedRows)
|
||||
if affectedRows then
|
||||
@@ -22,6 +23,7 @@ end)
|
||||
```lua
|
||||
-- alias: exports.oxmysql:update_async
|
||||
-- alias: MySQL.Sync.execute
|
||||
-- alias: exports.ghmattimysql:executeSync
|
||||
|
||||
local affectedRows = MySQL.update.await('UPDATE users SET firstname = ? WHERE identifier = ?', {newName, playerIdentifier})
|
||||
if affectedRows then
|
||||
|
||||
Reference in new issue
Block a user