I am having this really strange problem involving a query of queries that I
have never encountered before. Basically I am building a query with the
QueryNew() method:

<cfset REQUEST.SearchQuery = QueryNew(
  "title, date, preview, link, score",
  "VARCHAR, DATE, VARCHAR, VARCHAR, INTEGER"
  ) />

Then I build the query based on other queries. If I display this one, at
this point, it's totally fine. After building the query I do a QofQ like so:

<cfquery name="REQUEST.SearchQuery" dbtype="query">
  SELECT   title
  FROM    REQUEST.SearchQuery
  ORDER BY
    score DESC,
    [date] DESC
</cfquery>

This sometimes throws the following error: " Error casting an object of type
to an incompatible type. This usually indicates a programming error in Java,
although it could also mean you have tried to use a foreign object in a
different way than it was designed."

I have narrowed it down to the line of code that causes the "casting" issue.
It happens when I update the SCORE value. It really doesn't matter how it is
updated as long as it is set by a method call. 

For example, the following cause NO ERROR:

<cfset REQUEST.SearchQuery[ "score" ][ REQUEST.SearchQuery.CurrentRow ] =
100 />
<cfset REQUEST.SearchQuery[ "score" ][ REQUEST.SearchQuery.CurrentRow ] = 0
/>
<cfset REQUEST.SearchQuery[ "score" ][ REQUEST.SearchQuery.CurrentRow ] =
  REQUEST.SearchQuery[ "score" ][ REQUEST.SearchQuery.CurrentRow ] />


However, the following all cause error:

<cfset REQUEST.SearchQuery[ "score" ][ REQUEST.SearchQuery.CurrentRow ] =
ArrayLen( arrCriteria ) />
<cfset REQUEST.SearchQuery[ "score" ][ REQUEST.SearchQuery.CurrentRow ] = 
  Max( 5, REQUEST.SearchQuery[ "score" ][ REQUEST.SearchQuery.CurrentRow ] )
/>

Heck, even this causes errors:

REQUEST.SearchQuery[ "score" ][ REQUEST.SearchQuery.CurrentRow ] = 
  Max( REQUEST.SearchQuery[ "score" ][ REQUEST.SearchQuery.CurrentRow ], 
  REQUEST.SearchQuery[ "score" ][ REQUEST.SearchQuery.CurrentRow ] 
  ) />


Its like any function call that returns a number corrupts the SCORE value
for the QofQ.

NOW, EVEN MORE CRAZY, if I take out the data types in the QueryNew() method,
so that it is just:

<cfset REQUEST.SearchQuery = QueryNew(
  "title, date, preview, link, score",
  ) />

, the whole thing works like a charm. CRAZY!

Any suggestions? That has to be some sort of bug unless I am missing
something big here.


Thanks,
Ben
..............................
www.bennadel.com


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238067
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to