Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coudln't select by order #24

Closed
ONyambura opened this issue Sep 20, 2021 · 6 comments · Fixed by #31
Closed

Coudln't select by order #24

ONyambura opened this issue Sep 20, 2021 · 6 comments · Fixed by #31

Comments

@ONyambura
Copy link

ONyambura commented Sep 20, 2021

version '1.4.0'

        local query = exports.oxmysql:fetchSync("SELECT id, name, reward FROM gas_station_jobs WHERE gas_station_id = @gas_station_id AND progress = 0 ORDER BY id ASC", {
            ["@gas_station_id"] = gsID
        })

error

[      script:oxmysql] Error calling system tick function in resource oxmysql: Error: Undefined parameter name
[      script:oxmysql] stack:
[      script:oxmysql] Error: Undefined parameter name
[      script:oxmysql]     at toArrayParams (webpack-internal:///./node_modules/named-placeholders/index.js:106:49)
[      script:oxmysql]     at compile (webpack-internal:///./node_modules/named-placeholders/index.js:153:12)
[      script:oxmysql]     at PoolConnection._resolveNamedPlaceholders (webpack-internal:///./node_modules/mysql2/lib/connection.js:530:17)
[      script:oxmysql]     at PoolConnection.query (webpack-internal:///./node_modules/mysql2/lib/connection.js:543:10)
[      script:oxmysql]     at eval (webpack-internal:///./node_modules/mysql2/lib/pool.js:149:14)
[      script:oxmysql]     at eval (webpack-internal:///./node_modules/mysql2/lib/pool.js:45:37)
[      script:oxmysql]     at processTicksAndRejections (internal/process/task_queues.js:75:11)
[      script:oxmysql]     at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:62:3)
[      script:oxmysql]     at citizen:/scripting/v8/timer.js:227:32
@dunak-debug
Copy link
Member

You are passing parameter name with nil value

@1A3Dev
Copy link
Contributor

1A3Dev commented Sep 23, 2021

You are passing parameter name with nil value

I'm also having this issue, it seems to be parsing the values after the commas as parameters like I have SELECT count,item as name,price,label FROM shops WHERE ShopNumber = @id however it some reason parses it as SELECT count??? FROM shops WHERE ShopNumber = ?

which gives me the error Error: Undefined parameter item however if I do SELECT * FROM shops WHERE ShopNumber = @id then it works fine

@1A3Dev
Copy link
Contributor

1A3Dev commented Sep 23, 2021

It seems to be caused due to an error in the named-placeholders+1.1.2.patch regex (the comma before the @)

@dunak-debug
Copy link
Member

This comma is not the issue. It just specify OR statement for : or @

@1A3Dev
Copy link
Contributor

1A3Dev commented Sep 24, 2021

This comma is not the issue. It just specify OR statement for : or @

The issue is the comma on the regex, I removed it myself and it fixed the issue. For even more proof here is the current regex https://regexr.com/668tu and here is with the comma removed https://regexr.com/668u7

@dunak-debug
Copy link
Member

Oh sorry, you are right. My bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants