Look at this fragment from the esql taglib and read the comments I've
placed in
it :

<?xml version="1.0"?>
<!-- $Id: esql.xsl,v 1.54 2001/01/22 23:49:44 balld Exp $-->
<!--

(...)

  // line number is 406
  <!-- this is a normal query -->
  <xsl:otherwise>
    _esql_query.statement =
_esql_connection.connection.createStatement();
    _esql_query.results =
_esql_query.statement.execute(_esql_query.query);
  </xsl:otherwise>
</xsl:choose>

// my debug
System.out.println("ESQL : _esql_query.query = " + _esql_query.query);
System.out.println ("ESQL : _esql_query.results = " +
_esql_query.results);

// the query's fine, and _esql_query.results is 'false' as it should,
since from
// JAVA 1.3 Documentation for java.sql.statement, execute() returns
false
// for an update/insert or *no results matching the query* !!!

if (_esql_query.results) {
  _esql_query.resultset = _esql_query.statement.getResultSet();
  _esql_query.resultset_metadata = _esql_query.resultset.getMetaData();
  _esql_query.position = 0;
  if (_esql_query.skip_rows &gt; 0) {
    while (_esql_query.resultset.next()) {
      _esql_query.position++;
      if (_esql_query.position == _esql_query.skip_rows) {
        break;
      }
    }
  }
  <xsl:apply-templates select="esql:results"/>
  <xsl:apply-templates select="esql:no-results"/>
  _esql_query.resultset.close();
}
else {
  _esql_query.position = _esql_query.statement.getUpdateCount();
  if (_esql_query.position &gt;= 0) {
    <xsl:apply-templates select="esql:update-results/*"/>
  }
}
_esql_query.statement.close();

// since _esql_query.results is 'false', "esql:no-results" never gets
instantiated
// for a query which returns 'no-results' ?!?!?!?


I can't find any reasonable explanation for why only now I've found this

problem with esql. Donald, please can you give me a help?! Am I missing
something???? I've used the no-results tag more than once ... I didn't
found any
"malfunction" earlier just because the no-results condition was never
met ... until now.

I can't see how the no-results works for you this way, but I would love
to know your explanation.

Thanks in advance!!!
Luis Gois


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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

Reply via email to