Releases: overextended/oxmysql
v2.5.3
Further development on this resource is being halted. Actually writing code or contributing to FiveM is frowned upon by the masses and deterministic-bubble himself. I have no obligation to improve or update it, and likely won't unless absolutely "necessary".
If you want to benefit from fixes and improvements made to the mysql driver, you'll need to update dependencies, patch them, and build the resource yourself.
Bug Fixes
- execute: handle nil values in nested arrays (Linden)
- utils/parseExecute: incorrect parameter reassignment (Linden)
- database/rawExecute: append extra null values (Linden)
- config: update mysql_debug when using oxmysql_debug command (Linden)
Code Refactoring
v2.5.2
v2.5.1
v2.5.0
This update resolves some compatibility issues and adds support for a requested feature from #140.
set mysql_debug [
"ox_core",
"ox_inventory"
]
Using the above, instead of set mysql_debug true
, will only print to console for the specified resources. You can still use true for all resources.
You can also adjust the debug list during runtime with the following.
oxmysql_debug remove ox_core
oxmysql_debug add ox_core
These changes are not persistent, so restarting the resource will default to the entries set by the convar.
Features
- config: add command to modify mysql_debug (Linden)
Bug Fixes
- utils: named placeholders check (Linden)
- update: correct semver comparison (Linden)
- utils/parseArguments: check parameter truthiness (Linden)
Code Refactoring
- move connectionOptions to config (Linden)
Chores
Commits
v2.4.0
ghmattimysql compatibility
oxmysql now provides for dependency checks, and creates event handlers for ghmattimysql exports.
You shouldn't really use them, they just exist for closed-source resources and compiled (C#) resources.
Exports are only being provided for execute, scalar, transaction, store
and their "sync" (async_retval) variants.
npm package
If you missed it, we released @overextended/oxmysql as a node module.
This gives you access to similar syntax as Lua, with basic typescript support.
import { oxmysql as MySQL } from '@overextended/oxmysql';
MySQL.scalar('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier], (firstname) => {
console.log(firstname)
})
const firstname = await MySQL.scalar('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier])
console.log(firstname)
Features
- oxmysql exports wrapper as node package (Luke)
- lib: readme for npm package (Luke)
- provide exports for ghmattimysql (Linden)
Code Refactoring
- lib/ts: improve typing and methods (Linden)
- lib/lua: safeargs type checks and cb reassignment (Linden)
- lib/lua: improve definitions (Linden)
Continuous Integration
Chores
v2.3.4
Corrects some unexpected cross-runtime error handling. Take the following example, where we attempt to index a nil value.
MySQL.query('SELECT 1', {}, function()
MySQL.query.await('SELECT 1')
local t = {}
print(t[1].value)
end)
[ script:oxmysql] SCRIPT ERROR in promise (unhandled): Error: test was unable to execute a query!
[ script:oxmysql] undefined
[ script:oxmysql] SELECT 1 []
With this changeset will now return the script error and stack trace.
[ script:oxmysql] SCRIPT ERROR: @test/server.lua:76: attempt to index a nil value (field 'integer index')
[ script:oxmysql] > ref (@test/server.lua:76)
[ script:oxmysql] > (@oxmysql/dist/build.js:21745)
[ script:oxmysql] > processTicksAndRejections (node:internal/process/task_queues:96)
[ script:oxmysql] > async rawQuery (@oxmysql/dist/build.js:21735)
[ script:oxmysql]
This behaviour only presents itself when yielding a thread during a callback function reference; that is:
- using Citizen.Wait or Citizen.Await
- using the await / sync MySQL methods
New events will now be triggered when an error occurs, which may be useful for third-party logging (i.e. datadog, sentry).
AddEventHandler('oxmysql:error', function(data)
print(data.query)
print(json.encode(data.parameters))
print(data.message)
print(data.err)
print(data.invokingResource)
end)
Bug Fixes
- db/rawQuery: handle uncaught promise (Linden)
- error-events: Add invokingResource to error data (#129) #129 (Niek)
- utils/parseTransaction: check for array (Linden)
- db: handle errors during callbacks (Linden)
- update: return if current version is higher than release (Linden)
Commits
v2.3.3
v2.3.2
v2.3.1
v2.3.0
Introduces a third syntax for transactions, alongside the mysql-async compatible syntax.
This isn't necessarily better or preferred, rather just another way to perform transactions.
MySQL.prepare has also been reverted and no longer performs UPDATE and INSERT queries as transactions, due to some compatibility issues.
New
local success = MySQL.transaction.await({
{ 'INSERT INTO test VALUES (?, ?)', {'Linden', 'Linden'} },
{ 'UPDATE test SET a = ? WHERE b = ?', {'Peter', 'Linden'}},
})
Original
local success = MySQL.transaction.await({
{ query = 'INSERT INTO `test` (id) VALUES (?)', values = { 1 } },
{ query = 'INSERT INTO `test` (id) VALUES (?)', values = { 2 } }
})
local success = MySQL.transaction.await({
'INSERT INTO `test` (id, name) VALUES (:someid, :somename)',
'SET `name` = :newname IN `test` WHERE `id` = :someid'
}, {
['someid'] = 2, ['somename'] = 'John Doe', ['newname'] = 'John Notdoe'
})
Features
- ci: Automatic fxmanifest bumping (Luke)
Code Refactoring
- lib/lua: safeArgs error messages (Linden)
- transaction: support new transaction syntax (Linden)
- database: new URI parser (Linden)
Chores
- version bump (Linden)
Reverts
- execute: transaction api (Linden)
Full Changelog: v2.2.5...v2.3.0