Transactions are now supported thanks to @darksaid98
Syntax:
-- Shared Param Format
local queries = {
'INSERT INTO `bans` (token) VALUES (:test)',
'INSERT INTO `bans` (token) VALUES (:test)',
'INSERT INTO `bans` (token) VALUES (:test)',
}
local params = { ['test'] = 'thisisatestvalue' }
exports.oxmysql:transaction(queries, params, function(result)
print(result) -- true/false
end)
-- Specific Format
local queries = {
{ query = 'INSERT INTO `test` (id, text) VALUES (:nene, :meme)', values = { ['nene'] = 'thisisatest', ['meme'] = 'this is a text' } },
{ query = 'INSERT INTO `test` (id, text) VALUES (:nene, :meme)', values = { ['nene'] = 'thisisates2', ['meme'] = 'this is a text' } },
{ query = 'INSERT INTO `test` (id) VALUES (:nene)', parameters = { ['nene'] = 'thisisatest4' } },
}
exports.oxmysql:transaction(queries, function(result)
print(result) -- true/false
end)
Allows setting isolation level for transactions through convar mysql_transaction_isolation_level
.
The default value is 2
, it accepts integers 1-4
.
switch (GetConvarInt('mysql_transaction_isolation_level', 2)) {
case 1:
return 'SET TRANSACTION ISOLATION LEVEL REPEATABLE READ';
case 2:
return 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED';
case 3:
return 'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED';
case 4:
return 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE';
default:
return 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED';
};
Features
- Added transactions support (#20) #20 (darksaid98)
Code Refactoring
- Transaction tweaks and version bump 1.4.0 (dunak-debug)