Issue with adding queryparams using new Query()

Description

Try to make any db request using new Query and addParam() function

 

var query = new Query(returnType="array"); query.setSQL("select * from testTable WHERE column = :columnValue"); query.addParam(name="columnValue", value=20, type="integer"); var res1 = query.execute().getResult(); writeDump(res1);

 

Looks like value not resolved:

 

image-20241206-110142.png

Environment

 

image-20241206-110416.png

Attachments

8
  • 12 Dec 2024, 03:16 pm
  • 12 Dec 2024, 03:16 pm
  • 11 Dec 2024, 12:20 pm
  • 11 Dec 2024, 12:20 pm
  • 11 Dec 2024, 10:18 am
  • 06 Dec 2024, 12:23 pm
  • 06 Dec 2024, 11:04 am
  • 06 Dec 2024, 11:04 am

Activity

Show:

Pothys - MitrahSoft 27 December 2024 at 06:30

, As per the reporter, it was not a valid bug, so I am now closing this ticket.

Sasha Zavadskiy 12 December 2024 at 16:37

my fault. Thanks for explanations

Zac Spitzer 12 December 2024 at 16:22

seems to need to pass in the table query as an argument?

newQuery = new Query(dbtype='query', testQuery=testQuery);

https://trycf.com/gist/0de7c9fcc43df56f320911998b4b20bb/lucee6?theme=monokai

Sasha Zavadskiy 12 December 2024 at 15:16

Lucee 6.1.1.118

testQuery = queryNew( "name , age" , "varchar , numeric" , { name: [ "Susi" , "Urs" ] , age: [ 20 , 24 ] } ); dump(testQuery); queryString = 'SELECT * FROM testQuery'; queryExecuteRes = queryExecute( sql = queryString, options = {dbtype = 'query'} ); dump(queryExecuteRes); newQuery = new Query(dbtype='query'); newQuery.setSql(queryString); newQueryRes = newQuery.execute().getResult(); dump(newQueryRes); abort;

Result

 

image-20241212-150833.png

Same result on Lucee 6.0.4.10

Same result on Lucee 5.4.3.16

 

CFTry Result

image-20241212-151618.png

Maybe i’m doing something wrong.

Zac Spitzer 12 December 2024 at 14:17

there was a trace which wasn’t needed, I removed it, which should make it run a tiny little bit faster

https://github.com/lucee/Lucee/commit/b5cb25a9c7f055c94340370626a9f073cd2c0c20

We have some good test coverage here for new Query() with QoQ, if you can adapt that to reproduce the problem, that would be great?

https://github.com/lucee/Lucee/blob/6.2/test/tickets/LDEV0224_1.cfc#L53

Closed

Details

Assignee

Reporter

Priority

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Affects versions

Created 6 December 2024 at 11:04
Updated 27 December 2024 at 06:31
Resolved 27 December 2024 at 06:31

Flag notifications