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

callback-style functions do not throw errors #237

@AusHick

Description

@AusHick

Issue checklist

Please put x inside of the box that matches your issue.

  • I am using the latest release
  • I have referenced previously reported issues
  • I have referenced available documentation and cannot resolve the issue
  • I'm certain this is an issue with oxymysql, and not with my resource

Describe the bug
Using the callback-style functions for MySQL operations always return true in pcall, and have no other method of error handling. The promise-style functions do not have this issue, and will return false in pcall, with error result.

In this particular instance, the INSERT is attempted on a table that has not yet been created.

Screenshots
N/A

Code

print(pcall(MySQL.insert, "INSERT INTO player_ankle_monitors (serial, state, target, actor) VALUES(?, 1, ?, ?)",
	{
		keyItem.info.serial,
		qbClosestPlayer.PlayerData.citizenid,
		qbPlayer.PlayerData.citizenid
	},
	function(...)
		print("Query CB")
		print(arg)
		
		-- more code
	end))

The above returns true
Replacing MySQL.insert with MySQL.insert.await returns false and RESOURCENAME was unable to execute a query!

Expected behavior
Either the callback function should always be called and support error results as a second argument, or the callback should not be called and the MySQL function should return similarly to the promise counterpart.

Additional context
Add any other context about the problem here.

Server details

  • FXServer artifact 7290
  • Windows 10 x64

Database details

  • MariaDB
  • 11.5.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions