[Standalone] OxMySQL - Lightweight MySQL wrapper

Version 1.6.1 available

At this point the resource is essentially a drop-in replacement for MySQL-async if you don’t wish to use the exports directly; let me know if you encounter any issues that aren’t by design.

This update resolves nil parameters being undefined and resulting in failed queries, so you can enjoy inserting null into your tables til your hearts content.


what this problem ? always show this error.

Think I know the cause and it’s related to the fixes for nil parameters; looking into a fix now.

Update: v1.6.2

  • Resolved a regex error when parsing queries containing unescaped JSON strings.
    The only known instance of this is with ESX Legacy’s bulk SavePlayer function; basically it would attempt to resolve entries in JSON as though they were named placeholders.

  • Allow queries containing named placeholders to send nil parameters in cases where there are only nil parameters.

idk what am i doing wrong here but , i installed based on docs but still i get error like : SCRIPT ERROR: citizen:/scripting/lua/scheduler.lua:1155: No such export scalar in resource oxmysql

Follow documention.

(Download release version not source code)

1 Like

posible to get at least the invoking resource when there are for some reason empty prints?
image

I couldn’t tell you why there are empty prints, because every time it triggers a print it includes a message and the invoking resource; I’ve not experienced any other behaviour.

let result = await exports.oxmysql.scalarSync(`SELECT * FROM players`, {})

Why am i returning an empty obj when i use await?

I think you are using older artifacts where cfx_async_retval in V8 SCrt was not implemented yet. Update to newer

I’m using the lastest recommended 4394, should i use any other newer version?

EDIT: You were right, actually the lastest recommended one doesn’t have it yet. I downloaded the lastest one.

1 Like

ox detects tinyint ( 0 and 1 ) as false and true @dunak

mysql-async did the exact same thing.

i wasn’t speaking for the guy above, i’ve reported this as a bug. @linden

im getting this table expected got nil when trying to purchase a vehicle with my PDM, it worked perfectly fine up until switching to OxMySQL.

Is there any fix? I configured it correctly inside of the server.cfg and i do have a table or it wouldntve worked with ghmatti.

CODE:

local cols = ‘owner, cid, license_plate, current_garage, name, model, vehicle_state’

local vals = '@owner, @cid, @license_plate, @current_garage, @name, @model, @vehicle_state'

exports.oxmysql.execute('INSERT INTO characters_cars ('..cols..') VALUES ('..vals..')',{

        ['@owner'] = player,

        ['@cid'] = char.id,

        ['@license_plate'] = license_plate,

        ['@name'] = model,  -- temp fix for the NULL issue ~ munch | ill look at it later lol

        ['@model'] = model,

        ['@vehicle_state'] = "In",

        ['@current_garage'] = "T"

    })

SERVER.CFG

set mysql_connection_string “mysql://root@localhost/gtav_rp2”

ERROR PNG:

EDIT: also using the latest possible game build (NOT RECOMMENDED BUILD)

EDIT 2: It seems like its executing it but it throws that error.

That should be exports.oxmysql:execute in the Lua context (since it uses metatables and the __call method).

ive tried :execute rather than .execute but same thing happens, it does put it in the table though

exports.oxmysql:insert('INSERT INTO characters_cars (owner, cid, license_plate, current_garage, name, model, vehicle_state) VALUES (?, ?, ?, ?, ?, ?, ?)', {
	player, char.id,  license_plate, model, model, "In", "T"
})

Should work afaik; but if :execute isn’t working in this instance then I’ll need to have a look.

EDIT: ive tried your fix but it is still coming up with the table expected got nil.

1 Like

I cannot reproduce; there shouldn’t even be a retval from oxmysql, since you haven’t added a callback function to it.

1 Like

Okay, It might be my server.cfg connection string. What format is local host / VDS.

The username is root and it doesnt have a password