mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-04 06:28:53 +00:00
Update transaction.md
* Fix spelling mistakes
This commit is contained in:
1 file changed
+3
-3
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
# Transactions
|
# Transactions
|
||||||
|
|
||||||
A transaction executes multiple queries and commit them only if all succeed. If one fails, none of the queries are commited. 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.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ This is useful for transactions where the queries do not share many SQL variable
|
|||||||
local queries = {
|
local queries = {
|
||||||
{ query = 'INSERT INTO `test` (id) VALUES (:someid)', values = { ['someid'] = 1 } },
|
{ query = 'INSERT INTO `test` (id) VALUES (:someid)', values = { ['someid'] = 1 } },
|
||||||
{ query = 'INSERT INTO `test` (id) VALUES (:someid)', values = { ['someid'] = 2 } }
|
{ query = 'INSERT INTO `test` (id) VALUES (:someid)', values = { ['someid'] = 2 } }
|
||||||
} -- NOTE, the 'values' tables can be named 'parameters' here for MySQL-Async compatability.
|
} -- NOTE, the 'values' tables can be named 'parameters' here for MySQL-Async compatibility.
|
||||||
|
|
||||||
-- Async
|
-- Async
|
||||||
exports.oxmysql:transaction(queries, function(result)
|
exports.oxmysql:transaction(queries, function(result)
|
||||||
@@ -36,7 +36,7 @@ print(result)
|
|||||||
const queries = [
|
const queries = [
|
||||||
{ query = 'INSERT INTO `test` (id) VALUES (:someid)', values = { someid = 1 } },
|
{ query = 'INSERT INTO `test` (id) VALUES (:someid)', values = { someid = 1 } },
|
||||||
{ query = 'INSERT INTO `test` (id) VALUES (:someid)', values = { someid = 2 } }
|
{ query = 'INSERT INTO `test` (id) VALUES (:someid)', values = { someid = 2 } }
|
||||||
] // NOTE, the 'values' objects can be named 'parameters' here for MySQL-Async compatability.
|
] // NOTE, the 'values' objects can be named 'parameters' here for MySQL-Async compatibility.
|
||||||
|
|
||||||
// Async
|
// Async
|
||||||
exports.oxmysql.transaction(queries, (result) => {
|
exports.oxmysql.transaction(queries, (result) => {
|
||||||
|
|||||||
Reference in new issue
Block a user