You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by bu...@apache.org on 2004/03/04 16:10:46 UTC
DO NOT REPLY [Bug 27440] New: -
nesting-error in SQLTransformer
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=27440>.
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=27440
nesting-error in SQLTransformer
Summary: nesting-error in SQLTransformer
Product: Cocoon 2
Version: Current CVS 2.1
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: general components
AssignedTo: dev@cocoon.apache.org
ReportedBy: pmhahn@titan.lahn.de
What I was looking for was somethink like
SELECT key FROM a UNION B
SELECT * FROM a WHERE key
SELECT * FROM b WHERE key
When nesting multiple <sql:execute-query><sql:query/></sql:execute-query>s
inside a top-level <sql:execute-query>-element, nothing is
done/executed/displayed. This is due to a bug with
SQLTransformer.current_query_index:
Here is the relevant code from SQLTransformer.java:
413:startExecuteQueryElement() {
417: current_query_index = queries.size();
503:endExecuteQueryElement() {
506: if (current_query_index == 0) executeQuery(0)
511: else current_query_index--; // BUG!!!!
Here is a trace of an example to illustrate the bug:
<sql:execure-query> current_query_index := 0;
<sql:execute-query> current_query_index := 1;
</sql:execute-query> current_query_index := 1-- = 0;
<sql:execute-query> current_query_index := 2;
</sql:execute-query> current_query_index := 2-- = 1;
</sql:execute-query> current_query_index == 1 != 0 // NO executeQuery(0)
Analysis of the bug:
* current_query_index is used two-fold:
1. As an index into the Vector queries to indicate the last query,
2. As an indicator of nesting-level.
This only works when each <execute-query> contains at-most one other
<execute-query> element.
* Using current_query_index as an indicator for nesting-level does work for
<1><2><3/></2></1> but not for <1><2/><3/><1>.
* current_query_index is used in conjunction with sql:ancestor-value/@sql:level
to compute the parent query.
Clarification/comment:
A DTD for the current working (linear)queries would look like:
<!ELEMENT execute-query (query,execute-query?)>
A DTD for tree-queries, what I tried, would look like:
<!ELEMENT execute-query (query,execute-query*)>
Bug resolution:
Either document that only the 1st type of queries is allowed or rewrite
SQLTransformer to also allow the 2nd type of queries. Would a patch be accepted
if I would implement type 2?
Further comment:
I found one other posting of a person trying to do the same as I:
http://archives.real-time.com/pipermail/cocoon-users/2003-July/036617.html