cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Conover <scono...@groundswell.net>
Subject esql error -- (Donald?)
Date Sun, 10 Sep 2000 17:27:18 GMT
I'm just starting to use esql...I put a simple query into my xsp logicsheet

		<esql:execute-query>
			<esql:use-connection>prod01</esql:use-connection>
			<esql:query>
				select catg_id as categoryid, catg_name as
name
				from doc_category_t
				where catg_id=<xsl:copy-of
select="$categoryid"/>
			</esql:query>
		</esql:execute-query>

and got this error:

java.lang.Exception: XSP Java Compiler: Compilation failed for
_category.java 286: Duplicate variable declaration: Stack _esql_sessions was
Stack _esql_sessions
Stack _esql_sessions = new Stack(); 
287: Duplicate variable declaration: EsqlSession _esql_session was
EsqlSession _esql_session 
EsqlSession _esql_session = null; 

the culprit seems to be this part of esql:

<xsl:template match="xsp:page/*">
 <xsl:copy>
  <xsl:apply-templates select="@*"/>
  
  <xsp:logic>
   Stack _esql_sessions = new Stack();
   EsqlSession _esql_session = null;
  </xsp:logic>

  <xsl:apply-templates/>
 </xsl:copy>
</xsl:template>


am I missing something here, on the surface at least it seems like this code
should not be here...presumably people will be using esql between xsp:page
tags, and based on this you'd get duplicate declarations every time.
However, maybe I'm doing something wrong since it seems other people have
gotten this to work.  I've tried commenting out just the xsp:logic section
of this code a rebuilding cocoon.jar, and it seems to work fine.  I hesitate
to go forward like that though since that code may have some purpose...at
the end of this email is the relevant java code that was generated

Regards,
Steve


	 Stack _esql_sessions,
	 EsqlSession _esql_session) throws Exception {
		if (_esql_session != null) {
		 _esql_sessions.push(_esql_session);
		}
		_esql_session = new EsqlSession();
		try {
		 _esql_session.max_rows =
Integer.parseInt(String.valueOf(""));
		} catch (Exception _esql_e) {
		 _esql_session.max_rows = -1;
		}
		try {
		 _esql_session.skip_rows =
Integer.parseInt(String.valueOf(""));
		} catch (Exception _esql_e) {
		 _esql_session.skip_rows = 0;
		}
		try {
		
		  _esql_session.db_connection =
_esql_pool.getConnection(String.valueOf("prod01"));
		  _esql_session.connection =
_esql_session.db_connection.getConnection();
		 
	        
		 
		  
	       _esql_session.statement =
_esql_session.connection.createStatement();
	       _esql_session.query = String.valueOf(
			""
			
						+ "     select catg_id as
categoryid, catg_name as name     from doc_category_t     where catg_id="
					
						+
request.getParameter("categoryid"));
	       _esql_session.resultset =
_esql_session.statement.executeQuery(_esql_session.query);
	       _esql_session.resultset_metadata =
_esql_session.resultset.getMetaData();
	       _esql_session.count = 0;
	       if (_esql_session.skip_rows > 0) {
	        while (_esql_session.resultset.next()) {
		 _esql_session.count++;
		 if (_esql_session.count == _esql_session.skip_rows) {
	          break;
		 }
		}
	       }
	       boolean _esql_results = false;
	       while (_esql_session.resultset.next()) {
		_esql_results = true;
	        
		if (_esql_session.max_rows != -1 && _esql_session.count -
_esql_session.skip_rows == _esql_session.max_rows-1) {
		 break;
		}
		_esql_session.count++;
	       }
	       _esql_session.resultset.close();
	       _esql_session.statement.close();
	       if (!_esql_results) {
                
	       }
	       } catch (Exception _esql_e) {
		
    xspParentNode = xspCurrentNode;
    xspNodeStack.push(xspParentNode);
    xspCurrentNode =
      document.createElement("exception");
    xspParentNode.appendChild(xspCurrentNode);

    
    xspParentNode = xspCurrentNode;
    xspNodeStack.push(xspParentNode);
    xspCurrentNode =
      document.createElement("message");
    xspParentNode.appendChild(xspCurrentNode);

    
        xspCurrentNode.appendChild(
          xspExpr(_esql_e.getMessage(), document)
        );
      

    ((Element) xspCurrentNode).normalize();
    xspCurrentNode = (Node) xspNodeStack.pop();
  

    ((Element) xspCurrentNode).normalize();
    xspCurrentNode = (Node) xspNodeStack.pop();
  
		
	       } finally {
	       if (_esql_session.close_connection) {
	        if (_esql_session.connection != null)
_esql_session.connection.close();
	        
	         _esql_pool.releaseConnection(_esql_session.db_connection);
	        
	       }
	       if (_esql_sessions.empty()) {
	        _esql_session = null;
	       } else {
	        _esql_session = (EsqlSession)_esql_sessions.pop();
	       }
	      }
	     }
	
	//the two problem lines that are causing problems
   Stack _esql_sessions = new Stack();
   EsqlSession _esql_session = null;


Mime
View raw message