Skip to main content
Known Participant
January 17, 2010
Question

Mixed data type from mySQL 4/5 driver in CF9

  • January 17, 2010
  • 1 reply
  • 2322 views

I am not sure is this a feature or bug.

var query1 = queryNew("RenewalFrequency","varchar");

var query2 = queryNew("RenewalFrequency","varchar");

var query3 = queryNew("RenewalFrequency","varchar");

<cfquery datasource="test" name="query1"> SELECT Concat(1,' ','Year') AS RenewalFrequency FROM Skill </cfquery>

<cfquery datasource="test" name="query2"> SELECT Concat('1',' ','Year') AS RenewalFrequency FROM Skill </cfquery>

<cfquery datasource="test" name="query3"> SELECT if(ID > 10, Concat(1,' ','Year'), Concat('1',' ','Year')) AS RenewalFrequency

FROM Skill</cfquery>

When i use cfdump to dump all 3 queries.

query1 will display as data type = binary

query2 will display as data type = string

query3 will display mixed data type "string" and "binary"

I ran same 3 queries on CF8, all 3 return data type as "string".

 

I though you can't have mixed data type within the same column.

This topic has been closed for replies.

1 reply

BKBK
Community Expert
Community Expert
January 19, 2010

I cannot reproduce the problem. In all 3 cases isBinary() returns 'no' for every single value of RenewalFrequency. I expect concat(1,' ','Year') to be the same as  concat('1',' ','Year'), as MySQL would do a type conversion from integer to string. Could this have to do with your table, Skill, or with the fact that your code is within a function?

Known Participant
January 19, 2010

Thanks for your reply, BKBK.

The actually query is having a few outer join. The concat is join an interger column with a varchar(255) column.

What version of mySQL are you using? I am using the mySQL 5.1.

BKBK
Community Expert
Community Expert
January 19, 2010

Make sure your Skill table has at least 1 row, and test again.  My MySQL version is 5.1.24