Skip to content

Releases: CommunityOx/oxmysql

v2.13.1

02 May 16:00
d30676c

Choose a tag to compare

v2.13.1 Pre-release
Pre-release

This update only enables support for NodeJS v22. Requires FXServer 12913 or higher.

Almost all users will experience server crashes on artifacts 12913 or higher.
The developers of FiveM are too incompetent to fix any of the problems they have caused, so do not use this release.

v2.12.3

02 May 15:39

Choose a tag to compare

  • External logger services can now be loaded with set mysql_logger_service '@resource/path.js'.
  • Added support for mysql_option(s) in resource metadata (fxmanifest).
  • Added mysql_option 'return_callback_errors', allowing error handling in your callbacks.
MySQL.scalar('SELECT datefOfBirth FROM characters LIMIT 1', function(res, err)
    if err then error(err) end

    print('scalar', res)
end)
  • Added MySQL.startTransaction to library.
local success = MySQL.startTransaction(function(query)
    local a = query('INSERT INTO users (identifier) VALUES (?)', { 'someid' })

    -- if a is undefined, return false and rollback
    if not a then
        return false
    end

    -- errors in a query (e.g. syntax) will result in a rollback
    local b = query('SELEC * FROM users WHERE id = ? LIMIT 1', { a.insertId })

    -- transactions timeout after 30s to prevent connections being locked
    Wait(30000)

    -- throwing an error during a transaction will rollback
    if not b then
        error('sad')
    end

    -- no return, or any truthy value, will commit the transaction and release the connection
end)

print(success)