Skip to content

v2.9.1

Compare
Choose a tag to compare
@github-actions github-actions released this 06 Mar 03:00
· 57 commits to main since this release

(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