Using a column class to define an on-the-fly field is working fine for one
table but I think it has a bugette when you use a join.  Simplified example
for the query:

object_class - GARD::Book
sort_by - C_sourceyear
query - [bookowners.ownercode => {like => '%JB%'}]
with_objects - [bookowners]

produces:

SELECT
  IF(publishyear > originyear, originyear, publishyear) as C_sourceyear,
  t1.title,  t2.ownercode,...
FROM  books t1 LEFT OUTER JOIN bookowners t2 ON (t1.uid = t2.bookuid)
WHERE t2.ownercode LIKE "%JDS%"
ORDER BY t1.C_sourceyear;

which of course fails with Unknown column 't1.C_sourceyear'.

I've done some testing and if ORDER BY uses C_sourceyear, it does work so I
think this is due to the "t1" being appended onto the ORDER BY parameter by
Rose (I think reasonable behaviour given that Rose isn't supposed to know
about the alias and thinks it's a column).

Is there a way around this or am I simply taking the workaround a step too
far?


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to