I've just run into a problem using reactor OO queries to select data from a
table.
I'm trying to do "WHERE colA = x OR colB = x", however the generated sql
uses maxlengths in the cfqueryparams so if x is longer than colA or colB
then an error is thrown

SELECT  `Customer`.`CustomerId` FROM `Customer`
WHERE (
      `Customer`.`Email` LIKE <cfqueryparam cfsqltype="cf_sql_varchar"
maxlength="257"  value="#arguments.Query.getValue(1)#%" />
OR `Customer`.`ZipCode` LIKE <cfqueryparam cfsqltype="cf_sql_varchar" *
maxlength="12"*  value="#arguments.Query.getValue(2)#%" />
OR `Customer`.`LastName` LIKE <cfqueryparam cfsqltype="cf_sql_varchar"
maxlength="257"  value="#arguments.Query.getValue(3)#%" />
OR `Customer`.`CompanyName` LIKE <cfqueryparam cfsqltype="cf_sql_varchar"
maxlength="257"  value="#arguments.Query.getValue(4)#%" />
)

The query is for a really simple customer search, but as you can see because
zipcode is only 12 char long i'm getting an error if you enter a long
surname to search for.

can maxlength parameters only be added to cfqueryparams when inserting data?

Cheers, Chris


-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[EMAIL PROTECTED]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to