github overextended/oxmysql v2.12.0

13 hours ago
  • 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)

Features

  • lib/lua: add options and 'return_callback_errors' (Linden)
  • add startTransaction to library (Linden)
  • logger: support loading external loggers (Linden)

Bug Fixes

  • logger: catch errors when triggering error callback (Linden)
  • lib: assert query value when using query store (Linden)
  • revert citizenfx/server dependency update (Linden)
  • update types/node (Linden)
  • web: update and resolve conflicting dependencies (Linden)
  • utils/parseArguments: resolve null parameters in sparse arrays (Linden)
  • db/pool: set pool after confirming a connection (Linden)
  • db/pool: don't manually fetch connection (Linden)

Code Refactoring

  • database/pool: link to issues when connection fails (Linden)

Chores

Commits

  • bfe660b: v2.11.2 (GitHub Actions)

Don't miss a new oxmysql release

NewReleases is sending notifications on new releases.