> > Queries (and dumps) all run fine with either SQL statements alone or 
> 
> > with cfc and cfm scripts in CF8.  With CF9 however, the encrypted 
> > fields are returned as binary via cfdump even though the SQL 
> > statements themselves all run fine using Navicat for MySQL. I can 
> > overcome this by recoding he relevant cfm using 
> > CharsetEncode(datafield, "utf-8") but this results in an error when 
> 
> > used with CF8. Any thoughts or suggestions would be greatly 
> > appreciated.
> 
> It sounds a lot like this old MySQL bug. Though the comments say it 
> was fixed eons ago. If not, try casting it to a string in the sql
> http://bugs.mysql.com/bug.php?id=12872


Yep that was it.  Thanks so much for sorting that one out for me.  Now the code 
works in both CF8 and CF9

This works:

CAST(AES_DECRYPT('fieldname', 'key') AS CHAR) AS 'alias'

The field types in question are varchar.  The default encoding is UTF-8.  There 
does not seem to be a need to provide an length limit argument in the CHAR 
function.  i.e. CHAR alone works - not necessary to use CHAR(#).

Thanks again. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/sql/message.cfm/messageid:3351
Subscription: http://www.houseoffusion.com/groups/sql/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/sql/unsubscribe.cfm

Reply via email to