DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7181>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7181

esql:group behaves erratically

           Summary: esql:group behaves erratically
           Product: Cocoon 2
           Version: Current CVS
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: general components
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


this is a copy of the default ESQL sample page, changed to use <esql:group> to
group employees by department. Needless to say that the exact same query works
fine with <esql:get-columns/> (although the results then are flattened and
unusable).
______________________________________________________________________________
     <esql:execute-query>
       <esql:query>
       SELECT department.name, employee.id FROM department, employee
       WHERE department.id = employee.department_id  ORDER BY department.name
       </esql:query>
       <esql:results>
         <esql:row-results>
            <esql:group group-on='name'>
                <Department><xsp:attribute name='name'><esql:get-string
column='name'/></xsp:attribute>
                <esql:member><employee><esql:get-int
column='id'/></employee></esql:member>
                </Department>
            </esql:group>
         </esql:row-results>
       </esql:results>
     </esql:execute-query>
_________________________________________________________________________________


The XSP code above breaks when one changes 'employee.id' to 'employee.name AS
empName' in the SELECT statement, and <esql:get-int column='id'/> to
<esql:get-string column='empName'/> producing an invalid (let alone incomplete)
XML fragment, as shown below:
_________________________________________________________________________________
<content>
  <Department name="Development">
  <employee>
</content>
_________________________________________________________________________________


The same problem manifests itself with different RDBM's such as SQL Server,
Postgres and Access so it shouldn't be a problem with JDBC drivers or the
connection manager. 

I found the problem while working on large SQL queries that use aliases on
columns to differentiate columns with same names (e.g. 'name'). I suspect the
problem lies in the way the resultset's metadata are stored and used in
ESQLQuery.[getGroupingVar/setGroupingVar]. 

So, I download the whole Cocoon 2 CVS source and try to locate the bug. After
taking a quick glance inside the (huge) esql.xsl stylesheet, one word comes to
mind: CHAOS.  One cannot possibly figure out what happens, let alone try to fix
it. I don't think it's wise to keep the whole logic in one XSL, it's just
doesn't make any sense. I don't want to impose on the developers, but don't you
think a little "Divide and conquer" might help?


Elias

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to