Fix formatting

This commit is contained in:
Linden committed 2021-10-25 03:48:14 +11:00
1 parent 5bcec3a0b1
commit 2b40fafa7f
7 files changed
+39 -40

No files matched your search

+7 -7
View File
@@ -5,8 +5,8 @@ Generic function that can be utilised for any query, synonymous with fetch.
When selecting data it will return all matching rows and columns, otherwise it will return field data such as insertid, affectedRows, etc.
!!! info "Example"
=== "Lua
=== "Async"
=== "Lua"
**Async**
```lua
exports.oxmysql:execute('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
if result then
@@ -16,7 +16,7 @@ When selecting data it will return all matching rows and columns, otherwise it w
end
end)
```
=== "Sync"
**Sync**
```lua
local result = exports.oxmysql:executeSync('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
if result then
@@ -25,18 +25,18 @@ When selecting data it will return all matching rows and columns, otherwise it w
end
end
```
=== "JavaScript
=== "Async"
=== "JavaScript"
**Async**
```js
exports.oxmysql.execute('SELECT * FROM users WHERE identifier = ?', [playerIdentifier], function(result) {
if (result) {
result.forEach((v) => {
console.log(v.identifier, v.firstname, v.lastname)
})
})
}
})
```
=== "Sync"
**Sync**
```js
const result = exports.oxmysql.executeSync('SELECT * FROM users WHERE identifier = ?', [playerIdentifier]) {
if (result) {
+6 -6
View File
@@ -4,8 +4,8 @@ title: Insert
Inserts a new entry into the database and returns the insert id for the row, if valid.
!!! info "Example"
=== "Lua
=== "Async"
=== "Lua"
**Async**
```lua
exports.oxmysql:insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ', {playerIdentifier, firstName, lastName}, function(id)
if id then
@@ -13,22 +13,22 @@ Inserts a new entry into the database and returns the insert id for the row, if
end
end)
```
=== "Sync"
**Sync**
```lua
local id = exports.oxmysql:insertSync('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ', {playerIdentifier, firstName, lastName})
if id then
print(id)
end
```
=== "JavaScript
=== "Async"
=== "JavaScript"
**Async**
```js
exports.oxmysql.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ', [playerIdentifier, firstName, lastName], function(id) {
if (id)
console.log(id)
})
```
=== "Sync"
**Sync**
```js
const id = exports.oxmysql.insertSync('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?) ', [playerIdentifier, firstName, lastName]) {
if (id)
+6 -6
View File
@@ -4,8 +4,8 @@ title: Scalar
Returns the first column for a single row.
!!! info "Example"
=== "Lua
=== "Async"
=== "Lua"
**Async**
```lua
exports.oxmysql:scalar('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
if result then
@@ -13,22 +13,22 @@ Returns the first column for a single row.
end
end)
```
=== "Sync"
**Sync**
```lua
local result = exports.oxmysql:scalarSync('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier})
if result then
print(result.firstname)
end
```
=== "JavaScript
=== "Async"
=== "JavaScript"
**Async**
```js
exports.oxmysql.scalar('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier], function(result) {
if (result)
console.log(result.firstname)
})
```
=== "Sync"
**Sync**
```js
const result = exports.oxmysql.scalarSync('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier]) {
if (result)
+6 -6
View File
@@ -4,8 +4,8 @@ title: Single
Returns the columns for a single row.
!!! info "Example"
=== "Lua
=== "Async"
=== "Lua"
**Async**
```lua
exports.oxmysql:single('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
if result then
@@ -13,22 +13,22 @@ Returns the columns for a single row.
end
end)
```
=== "Sync"
**Sync**
```lua
local result = exports.oxmysql:singleSync('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
if result then
print(result.identifier, result.firstname, result.lastname)
end
```
=== "JavaScript
=== "Async"
=== "JavaScript"
**Async**
```js
exports.oxmysql.single('SELECT * FROM users WHERE identifier = ?', [playerIdentifier], function(result) {
if (result)
console.log(result.identifier, result.firstname, result.lastname)
})
```
=== "Sync"
**Sync**
```js
const result = exports.oxmysql.singleSync('SELECT * FROM users WHERE identifier = ?', [playerIdentifier]) {
if (result)
+2 -2
View File
@@ -30,7 +30,7 @@ local result = exports.oxmysql:transactionSync(queries)
print(result)
```
Javascript
JavaScript
```js
const queries = [
{ query = 'INSERT INTO `test` (id) VALUES (:someid)', values = { someid = 1 } },
@@ -70,7 +70,7 @@ local result = exports.oxmysql:transactionSync(queries, parameters)
print(result)
```
Javascript
JavaScript
```js
const queries = [
'INSERT INTO `test` (id, name) VALUES (:someid, :somename)',
+6 -6
View File
@@ -4,8 +4,8 @@ title: Update
Updates an entry in the database and returns the number of affected rows.
!!! info "Example"
=== "Lua
=== "Async"
=== "Lua"
**Async**
```lua
exports.oxmysql:insert('UPDATE users SET firstname = ? WHERE identifier = ? ', {newName, playerIdentifier}, function(affectedRows)
if affectedRows then
@@ -13,22 +13,22 @@ Updates an entry in the database and returns the number of affected rows.
end
end)
```
=== "Sync"
**Sync**
```lua
local id = exports.oxmysql:insertSync('UPDATE users SET firstname = ? WHERE identifier = ? ', {newName, playerIdentifier})
if affectedRows then
print(affectedRows)
end
```
=== "JavaScript
=== "Async"
=== "JavaScript"
**Async**
```js
exports.oxmysql.insert('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier], function(affectedRows) {
if (affectedRows)
console.log(affectedRows)
})
```
=== "Sync"
**Sync**
```js
const id = exports.oxmysql.insertSync('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier]) {
if (affectedRows)