mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 22:21:48 +00:00
Consistent indentation and remove some files
Mixing tabs and spaces when embedding Lua can easily break MDX syntax.
This commit is contained in:
1 parent
b87ef48d2e
commit
6bead3ca32
21 files changed
+146
-240
No files matched your search
@@ -9,7 +9,7 @@ Inserts a new entry into the database and returns the insert id for the row, if
|
||||
-- Alias: exports.oxmysql:insert
|
||||
-- Alias: MySQL.Async.insert
|
||||
MySQL.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', {playerIdentifier, firstName, lastName}, function(id)
|
||||
print(id)
|
||||
print(id)
|
||||
end)
|
||||
```
|
||||
|
||||
@@ -18,8 +18,8 @@ end)
|
||||
-- Alias: exports.oxmysql:insert_async
|
||||
-- Alias: MySQL.Sync.insert
|
||||
CreateThread(function()
|
||||
local id = MySQL.insert.await('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', {playerIdentifier, firstName, lastName})
|
||||
print(id)
|
||||
local id = MySQL.insert.await('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', {playerIdentifier, firstName, lastName})
|
||||
print(id)
|
||||
end)
|
||||
```
|
||||
|
||||
|
||||
@@ -17,11 +17,11 @@ When using SELECT, the return value will match `query, single, or scalar` depend
|
||||
-- Alias: MySQL.Async.prepare
|
||||
|
||||
MySQL.prepare('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
|
||||
if result then
|
||||
for _, v in pairs(result) do
|
||||
print(v.identifier, v.firstname, v.lastname)
|
||||
end
|
||||
end
|
||||
if result then
|
||||
for _, v in pairs(result) do
|
||||
print(v.identifier, v.firstname, v.lastname)
|
||||
end
|
||||
end
|
||||
end)
|
||||
```
|
||||
|
||||
@@ -31,12 +31,12 @@ end)
|
||||
-- Alias: MySQL.Sync.prepare
|
||||
|
||||
CreateThread(function()
|
||||
local result = MySQL.prepare.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
|
||||
if result then
|
||||
for _, v in pairs(result) do
|
||||
print(v.identifier, v.firstname, v.lastname)
|
||||
end
|
||||
end
|
||||
local result = MySQL.prepare.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
|
||||
if result then
|
||||
for _, v in pairs(result) do
|
||||
print(v.identifier, v.firstname, v.lastname)
|
||||
end
|
||||
end
|
||||
end)
|
||||
```
|
||||
|
||||
@@ -48,7 +48,7 @@ exports.oxmysql.prepare('SELECT * FROM users WHERE identifier = ?', [playerIdent
|
||||
if (result) {
|
||||
result.forEach((v) => {
|
||||
console.log(v.identifier, v.firstname, v.lastname)
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
+12
-12
@@ -10,11 +10,11 @@ When selecting data it will return all matching rows and columns, otherwise it w
|
||||
-- Alias: MySQL.Async.query
|
||||
|
||||
MySQL.query('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
|
||||
if result then
|
||||
for _, v in pairs(result) do
|
||||
print(v.identifier, v.firstname, v.lastname)
|
||||
end
|
||||
end
|
||||
if result then
|
||||
for _, v in pairs(result) do
|
||||
print(v.identifier, v.firstname, v.lastname)
|
||||
end
|
||||
end
|
||||
end)
|
||||
```
|
||||
### Promise
|
||||
@@ -23,12 +23,12 @@ end)
|
||||
-- Alias: MySQL.Sync.query
|
||||
|
||||
CreateThread(function()
|
||||
local result = MySQL.query.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
|
||||
if result then
|
||||
for _, v in pairs(result) do
|
||||
print(v.identifier, v.firstname, v.lastname)
|
||||
end
|
||||
end
|
||||
local result = MySQL.query.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
|
||||
if result then
|
||||
for _, v in pairs(result) do
|
||||
print(v.identifier, v.firstname, v.lastname)
|
||||
end
|
||||
end
|
||||
end)
|
||||
```
|
||||
|
||||
@@ -40,7 +40,7 @@ exports.oxmysql.query('SELECT * FROM users WHERE identifier = ?', [playerIdentif
|
||||
if (result) {
|
||||
result.forEach((v) => {
|
||||
console.log(v.identifier, v.firstname, v.lastname)
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
@@ -9,7 +9,7 @@ Returns the first column for a single row.
|
||||
-- Alias: MySQL.Async.fetchScalar
|
||||
|
||||
MySQL.scalar('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier}, function(firstname)
|
||||
print(firstname)
|
||||
print(firstname)
|
||||
end)
|
||||
```
|
||||
|
||||
@@ -19,8 +19,8 @@ end)
|
||||
-- Alias: MySQL.Sync.fetchScalar
|
||||
|
||||
CreateThread(function()
|
||||
local firstname = MySQL.scalar.await('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier})
|
||||
print(firstname)
|
||||
local firstname = MySQL.scalar.await('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier})
|
||||
print(firstname)
|
||||
end)
|
||||
```
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ Returns the columns for a single row.
|
||||
-- Alias: MySQL.Async.fetchSingle
|
||||
|
||||
MySQL.single('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
|
||||
if result then
|
||||
print(result.identifier, result.firstname, result.lastname)
|
||||
end
|
||||
if result then
|
||||
print(result.identifier, result.firstname, result.lastname)
|
||||
end
|
||||
end)
|
||||
```
|
||||
|
||||
@@ -21,10 +21,10 @@ end)
|
||||
-- Alias: MySQL.Sync.fetchSingle
|
||||
|
||||
CreateThread(function()
|
||||
local result = MySQL.single.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
|
||||
if result then
|
||||
print(result.identifier, result.firstname, result.lastname)
|
||||
end
|
||||
local result = MySQL.single.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
|
||||
if result then
|
||||
print(result.identifier, result.firstname, result.lastname)
|
||||
end
|
||||
end)
|
||||
```
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ Returns the number of affected rows by the query.
|
||||
-- Alias: MySQL.Async.execute
|
||||
|
||||
MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ?', {newName, playerIdentifier}, function(affectedRows)
|
||||
if affectedRows then
|
||||
print(affectedRows)
|
||||
end
|
||||
if affectedRows then
|
||||
print(affectedRows)
|
||||
end
|
||||
end)
|
||||
```
|
||||
|
||||
@@ -21,10 +21,10 @@ end)
|
||||
-- Alias: MySQL.Sync.execute
|
||||
|
||||
CreateThread(function()
|
||||
local affectedRows = MySQL.update.await('UPDATE users SET firstname = ? WHERE identifier = ?', {newName, playerIdentifier})
|
||||
if affectedRows then
|
||||
print(affectedRows)
|
||||
end
|
||||
local affectedRows = MySQL.update.await('UPDATE users SET firstname = ? WHERE identifier = ?', {newName, playerIdentifier})
|
||||
if affectedRows then
|
||||
print(affectedRows)
|
||||
end
|
||||
end)
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user