cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 7181] - esql:group behaves erratically
Date Mon, 18 Mar 2002 17:04:39 GMT
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





------- Additional Comments From phantom@stserv.hcf.jhu.edu  2002-03-18 17:04 -------
Elias,

can you try adding <error-results/> and seeing what the exception is?
esql eats exceptions unless you do that.

<esql:execute-query>
  <esql:query>
    SELECT department.name as deptName, employee.id, employee.name as empName 
    FROM department, employee
    WHERE department.id = employee.department_id  ORDER BY department.name
  </esql:query>
  <esql:results>
    <esql:row-results>
      <esql:group group-on='deptName'>
        <Department><xsp:attribute name='name'><esql:get-string
column='deptName'/></xsp:attribute>
        <esql:member>
          <employee><esql:get-string column='empName'/></employee>
        </esql:member>
        </Department>
      </esql:group>
    </esql:row-results>
+       <esql:error-results>
+         <esql:get-message/>
+         <esql:get-stacktrace/>
+       </esql:error-results>
  </esql:results>
</esql:execute-query>

_esql_query.setGroupingVar("deptNameOld",
_esql_query.getResultSet().getString("deptName"));

>Now, I am no JDBC expert, but isn't this ResultSet.getString() supposed to
>return a reference to the current row's value? wouldn't resultSet.next()
>invalidate it?

would you prefer: 
_esql_query.setGroupingVar("deptNameOld",
new String(_esql_query.getResultSet().getString("deptName")));
?

I don't think it makes a difference since if there is a reference to the string 
from within the hash table it should prevent it from getting garbage collected 
no matter where the recordset pointer is.

>I am _very_ new to Cocoon, so I don't know if I could change things without
>messing up... Are there any specific reasons _not_ to keep the grouping code
>inside EsqlQuery.java?

I did the grouping code--only the grouping code.  I didn't think of another way 
to do it.  So the answer is that there aren't any specific reasons.

If you can refactor it and make it work I would certainly be grateful to you... 
I'm sure that it would be appreciated by others as well.  improvements that 
improve maintainability are the some of the best contributions since they can 
be the least rewarding in the scratch your itch area.

If you don't want to spend much time on it, I understand that as well. 
I just want to understand the bugs enough to fix them.

I know of two other bugs related to esql:group right now.
 bug 8187:
     <esql:group> footer uses future record's data rather than 
      most recent record.

     The patch i have posted for 8187 causes this bug for hsql since previous() 
isn't implemented.  an exception is thrown and the code that closes your 
<department> is never reached.

 bug notyetinbugzilla:
     <esql:group> cannot be used in a subquery.  I think i have a fix for this 
one also.


Let me know if some exceptions are revealed.

Tim

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message