Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.

Releases: overextended/oxmysql

v2.5.3

14 Nov 01:42
Compare
Choose a tag to compare

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

  • src/config: poll convars (Linden)
  • database: waitForConnection (Linden)

v2.5.2

02 Nov 18:10
Compare
Choose a tag to compare

Bug Fixes

  • src/config: only parse JSON for valid connection fields (Linden)

Code Refactoring

  • lib/define: improve Lua types (Linden)

v2.5.1

21 Sep 04:14
Compare
Choose a tag to compare

Bug Fixes

  • src/config: parse JSON objects in connection string (Linden)

Chores

  • update dependencies and patch (Linden)

v2.5.0

24 Aug 10:24
Compare
Choose a tag to compare

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

  • fxmanifest: update description (Linden)
  • include .yarn.installed (Linden)

Commits

  • config: accept a JSON array for mysql_debug (Linden)
  • logger: mysql_debug array-check (Linden)
  • utils: check if namedPlaceholders are enabled (Linden)

v2.4.0

28 Jul 04:57
Compare
Choose a tag to compare

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

  • release/pre-release: copy only lua lib files (Luke)
  • release: version bumper (Linden)

Chores

  • update discord link in readme (Luke)
  • lib: bump package version (Luke)

v2.3.4

27 Jun 07:01
Compare
Choose a tag to compare

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

18 Jun 06:34
Compare
Choose a tag to compare

Code Refactoring

v2.3.2

18 Jun 04:21
Compare
Choose a tag to compare

Features

  • lib: handle errors inside invoking resource (Linden)

Bug Fixes

  • error handling when using callbacks (Linden)
  • db: supportBigNumbers (Linden)

Code Refactoring

  • error handling (Linden)
  • db/execute: mysql2 callback api (Linden)

Chores

v2.3.1

15 May 18:48
Compare
Choose a tag to compare

Features

Bug Fixes

  • db: ignore errors during ref call (Linden)
  • utils/parseExecute: executeType fails when query has multiple lines (Linden)

Chores

Commits

  • fc0c025: Update README.md (Linden)

v2.3.0

29 Apr 18:16
Compare
Choose a tag to compare

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

Reverts

  • execute: transaction api (Linden)

Full Changelog: v2.2.5...v2.3.0