github overextended/oxmysql v2.9.1

latest releases: v2.12.0, v2.11.2, v2.11.1...
8 months ago

(Experimental) New transaction usage

This function is not yet fully supported and will receive breaking changes in future updates - this export and information is provided only for feedback and testing purposes.

Sample usage of the new transaction export.

CreateThread(function()
    local success = exports.oxmysql:experimentalTransaction(function(query)
        local a = query('INSERT INTO users (identifier) VALUES (?)', { 'someid' })
        
        if not a then return false end -- if a is undefined, return false and rollback
        
        -- local b = query('SELEC * FROM users WHERE id = ? LIMIT 1', { a.insertId }) -- syntax error leads to rollback

        -- Wait(30000) -- connection will timeout and rollback transaction

        -- error('sad') -- any errors will rollback

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

    print(success)
end)

Bug Fixes

  • db: incorrect error handling when no callback is defined (Linden)

Code Refactoring

  • db/startTransaction: remove execute from cb (Linden)
  • db/startTransaction: add 30s timeout to transactions (Linden)
  • db/startTransaction: include query and values in errors (Linden)

Commits

Don't miss a new oxmysql release

NewReleases is sending notifications on new releases.