Fixed
Details
Details
Assignee
Michael Offner
Michael OffnerReporter
Former user
Former user(Deactivated)Priority
Fix versions
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
Created 12 March 2015 at 10:24
Updated 16 June 2017 at 05:42
Resolved 7 December 2015 at 12:53
There is a deviation between how QueryExecute and new Query() behave in that QueryExecute does not seem to handle lists of integers in the same way as Query.
The following code will error indicating that the supplied string cannot be cast to a number value
arrayOfNumbers = [ 1 , 2 , 3 , 4 , 5 ]; // This will fail with the following error // cannot cast [1,2,3,4,5] string to a number value queryExecute( params = { myNumbers: { value = ArrayToList( arrayOfNumbers , ',' ) , sqltype = 'integer' , list = true , separator = ',' } }, options = { datasource = application.config.datasource }, sql = " SELECT * FROM myTableWithIDsIn WHERE id IN ( :myNumbers ) " );
However the following example will operate as intended and use the list of numerics as a list of numerics
arrayOfNumbers = [ 1 , 2 , 3 , 4 , 5 ]; // This will work (assuming the table exists) var q = new Query( datasource = application.config.datasource ); q.addParam( name = 'myNumbers' , value = ArrayToList( arrayOfNumbers , ',' ) , sqltype = 'integer' , list = true , separator = ',' ); q.execute( sql = " SELECT * FROM myTableWithIDsIn WHERE id IN ( :myNumbers ) " );