Highlighted

Issue with QoQ - Posting for a developer

New Here ,
Mar 16, 2015

Copy link to clipboard

Copied

Just a heads up, I am a network guy posting for one of our developers who is too busy to take this on himself.

We were running a CF 9 production application and recently updated to CF 11. There are a few QoQ's that are now broken since the update.

I am not going to pretend like I know what I am talking about, but in CF 9, the following query returns the correct results, Toyota and Honda. In CF 11, it does not and we think its because the "TYT" and "HND" have trailing spaces.

<cfset list=queryNew("code,description","varchar,varchar")>

<cfset queryAddRow(list)>

<cfset querySetCell(list,"code","TYT ")>

<cfset querySetCell(list,"description","Toyota")>

<cfset queryAddRow(list)>

<cfset querySetCell(list,"code","HND ")>

<cfset querySetCell(list,"description","Honda")>

<cfset queryAddRow(list)>

<cfset querySetCell(list,"code","HMMR ")>

<cfset querySetCell(list,"description","Hummer")>

<cfset queryAddRow(list)>

<cfset querySetCell(list,"code","CHVLT")>

<cfset querySetCell(list,"description","Chevrolet")>

Data inside the "list" table.

<table border="1" cellspacing="0" cellpadding="4">

<tr>

<td>Code</td>

<td>Code Length</td>

<td>Description</td>

</tr>

<cfoutput query="list">

<tr>

<td>#list.code#</td>

<td>#Len(list.code)#</td>

<td>#list.description#</td>

</tr>

</cfoutput>

</table>

<br /><br />

Select * from list where code='TYT' or code='HND'

<br /><br />In ColdFusion 6, the above query will give you Toyota and Honda, but in ColdFusion 11, it will not give you any results.

<br /><br />

Query Result:

<cfquery name="tyt" dbtype="query">

Select * from list where code='TYT' or code='HND'

</cfquery>

<cfdump var="#tyt#">

Thanks in advance!

Views

547

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Issue with QoQ - Posting for a developer

New Here ,
Mar 16, 2015

Copy link to clipboard

Copied

Just a heads up, I am a network guy posting for one of our developers who is too busy to take this on himself.

We were running a CF 9 production application and recently updated to CF 11. There are a few QoQ's that are now broken since the update.

I am not going to pretend like I know what I am talking about, but in CF 9, the following query returns the correct results, Toyota and Honda. In CF 11, it does not and we think its because the "TYT" and "HND" have trailing spaces.

<cfset list=queryNew("code,description","varchar,varchar")>

<cfset queryAddRow(list)>

<cfset querySetCell(list,"code","TYT ")>

<cfset querySetCell(list,"description","Toyota")>

<cfset queryAddRow(list)>

<cfset querySetCell(list,"code","HND ")>

<cfset querySetCell(list,"description","Honda")>

<cfset queryAddRow(list)>

<cfset querySetCell(list,"code","HMMR ")>

<cfset querySetCell(list,"description","Hummer")>

<cfset queryAddRow(list)>

<cfset querySetCell(list,"code","CHVLT")>

<cfset querySetCell(list,"description","Chevrolet")>

Data inside the "list" table.

<table border="1" cellspacing="0" cellpadding="4">

<tr>

<td>Code</td>

<td>Code Length</td>

<td>Description</td>

</tr>

<cfoutput query="list">

<tr>

<td>#list.code#</td>

<td>#Len(list.code)#</td>

<td>#list.description#</td>

</tr>

</cfoutput>

</table>

<br /><br />

Select * from list where code='TYT' or code='HND'

<br /><br />In ColdFusion 6, the above query will give you Toyota and Honda, but in ColdFusion 11, it will not give you any results.

<br /><br />

Query Result:

<cfquery name="tyt" dbtype="query">

Select * from list where code='TYT' or code='HND'

</cfquery>

<cfdump var="#tyt#">

Thanks in advance!

Views

548

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 16, 2015 0
LEGEND ,
Mar 17, 2015

Copy link to clipboard

Copied

Have you tried redoing the querySetCell() to remove the extra space?  Or include the extra space in the SELECT query of query?

^_^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 17, 2015 0
Advocate ,
Mar 18, 2015

Copy link to clipboard

Copied

The white spaces will cause you a problem here. When you do the query it is checking to see if code='TYT' or code='HND' which with the white space on the end is obviously false. You will either have to add the white space into the query, change the operator to 'LIKE' with a wildcard or remove it from the data. I would suggest just removing it unless its imperative you need it. 

It probably worked in previous version due to a bug which was fixed in more recent versions.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 18, 2015 2
BKBK LATEST
Adobe Community Professional ,
Mar 24, 2015

Copy link to clipboard

Copied

I think Haxtbh answers the question completely.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 24, 2015 0