mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 06:28:54 +00:00
update oxmysql js usage
and somewhat clean up transaction docs
This commit is contained in:
1 parent
1363afcd2a
commit
3d627ba762
8 files changed
+178
-81
No files matched your search
@@ -8,9 +8,9 @@ Returns the columns for a single row.
|
||||
-- alias: exports.oxmysql:single
|
||||
-- alias: MySQL.Async.fetchSingle
|
||||
|
||||
MySQL.single('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
|
||||
if result then
|
||||
print(result.identifier, result.firstname, result.lastname)
|
||||
MySQL.single('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(row)
|
||||
if row then
|
||||
print(row.identifier, row.firstname, row.lastname)
|
||||
end
|
||||
end)
|
||||
```
|
||||
@@ -20,9 +20,9 @@ end)
|
||||
-- alias: exports.oxmysql:single_async
|
||||
-- alias: MySQL.Sync.fetchSingle
|
||||
|
||||
local result = MySQL.single.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
|
||||
if result then
|
||||
print(result.identifier, result.firstname, result.lastname)
|
||||
local row = MySQL.single.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
|
||||
if row then
|
||||
print(row.identifier, row.firstname, row.lastname)
|
||||
end
|
||||
```
|
||||
|
||||
@@ -30,17 +30,21 @@ end
|
||||
|
||||
### Callback
|
||||
```js
|
||||
exports.oxmysql.single('SELECT * FROM users WHERE identifier = ?', [playerIdentifier],(result) => {
|
||||
if (result) {
|
||||
console.log(result.identifier, result.firstname, result.lastname)
|
||||
// alias: exports.oxmysql.single
|
||||
|
||||
MySQL.single('SELECT * FROM users WHERE identifier = ?', [playerIdentifier],(row) => {
|
||||
if (row) {
|
||||
console.log(row.identifier, row.firstname, row.lastname)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### Promise
|
||||
```js
|
||||
const result = await exports.oxmysql.single_async('SELECT * FROM users WHERE identifier = ?', [playerIdentifier])
|
||||
if (result) {
|
||||
console.log(result.identifier, result.firstname, result.lastname)
|
||||
// alias: exports.oxmysql.single_async
|
||||
|
||||
const row = await MySQL.single('SELECT * FROM users WHERE identifier = ?', [playerIdentifier])
|
||||
if (row) {
|
||||
console.log(row.identifier, row.firstname, row.lastname)
|
||||
}
|
||||
```
|
||||
Reference in new issue
Block a user