diff --git a/core/src/main/java/lucee/runtime/functions/query/QuerySetCell.java b/core/src/main/java/lucee/runtime/functions/query/QuerySetCell.java index 4079f9a14c..608c4838ae 100644 --- a/core/src/main/java/lucee/runtime/functions/query/QuerySetCell.java +++ b/core/src/main/java/lucee/runtime/functions/query/QuerySetCell.java @@ -38,7 +38,7 @@ public static boolean call(PageContext pc, Query query, String columnName, Objec public static boolean call(PageContext pc, Query query, String columnName, Object value, double rowNumber) throws PageException { if (rowNumber == -9999) rowNumber = query.getRecordcount();// used for named arguments - query.setAt(KeyImpl.init(columnName), (int) rowNumber, value); + query.setAt(KeyImpl.init(columnName.trim()), (int) rowNumber, value); return true; } diff --git a/test/tickets/LDEV2637.cfc b/test/tickets/LDEV2637.cfc new file mode 100644 index 0000000000..fe137c863b --- /dev/null +++ b/test/tickets/LDEV2637.cfc @@ -0,0 +1,19 @@ +component extends="org.lucee.cfml.test.LuceeTestCase" { + + function run( testResults , testBox ) { + myQuery = QueryNew("myCol1, myCol2,myCol3", "varchar,varchar,varchar"); + QueryAddRow(myQuery, 1); + + describe( "test suite for LDEV2637", function() { + it(title = "QuerySetCell column name without spaces", body = function( currentSpec ) { + QuerySetCell(myQuery,"myCol2","Lucee", 1); + expect("Lucee").toBe(myQuery.myCol2); + }); + + it(title = "QuerySetCell column name with spaces", body = function( currentSpec ) { + QuerySetCell(myQuery," myCol2","Lucee", 1); + expect("Lucee").toBe(myQuery.myCol2); + }); + }); + } +} \ No newline at end of file