This does look like it might be a bug.  For me the following code
creates a cfqueryparam with maxlength 1. Incidentally if you remove the
maxlength attribute, you'll still get an error because cf won't
recognise "2006-%" as a valid datetime string.
 
<cfset gw = reactor.creategateway("Table")>
<cfset q = gw.createquery()>
<cfset q.getWhere().isLike("Table", "DateTimeColumn", "2006-", "Right")>
<cfdump var="#gw.getByQuery(q)#">
 
Derek, It looks like your trying to retrieve records based on a date
range, so you would be better off using isBetween.  I suspect LIKE is a
fairly inefficient comparison, whereas BETWEEN should be much faster on
an indexed DateTime column.
 
<cfset q.getWhere().isBetween("Table", "DateTimeColumn", "2006-11-01",
"2006-11-15")>

Cheers, Chris

________________________________

        From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Derek P.
        Sent: 15 November 2006 20:05
        To: [email protected]
        Subject: [Reactor for CF] Problem with isLike and DateTime
fields (mysql5)



        Hey,

         

        I need to be able to filter datetime fields with a SQL statement
like this:

         

        SELECT dt FROM table

        WHERE dt LIKE "2006-%"

         

        Or something of that nature. I used the where.isLike() statement
and loaded the value 2006-11 (because is like will wrap %'s around them)
and I get this error:

         

        Message: The cause of this output exception was that:
coldfusion.tagext.sql.QueryParamTag$InvalidDataException: Invalid data
%2006-11% value exceeds MAXLENGTH setting 2..

         

        If you check the code in the query it creates it sets the
queryparam to maxlength 2. is this a bug? Or what am I doing wrong?

         

        Thanks!

        - Derek

         

         


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



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

Reply via email to