Hello All,

I have opened a bug case in bugzilla for the ESQL logicsheet: it doesn't
behave correctly for some kinds of grouped resultsets (<esql:group>). I
have tried to debug the logicsheet but it's far too complex to understand
(yet alone debug...) Suffice to say that most logicsheets in the same dir
are about 10-20kb in size, and esql.xsl is about 55kb (plus the size of
the accompanying Esql*.java classes)

A rather daunting question: would it be wise for use to be thinking about
reimplementing the ESQL logicsheet, just to scale down its complexity? I
have rewritten the xsd schema, simplifying the <esql:get-*>
elements.. (really, why did there had to be a separate element for each
datatype?). Another big problem is that of poor documentation: Except from
the userdoc "howto", there is very little to go from there.. I think that
starting from a properly documented schema would be of major importance.

I am attaching a schema I derived from the one that I downloaded from
2.0.2-dev CVS. It doesn't contain any definitions for grouping
functionality yet, because I think there's an inherent problem in the
logicsheet architecture: helper classes like EsqlQuery.java cannot trigger
events or callbacks, and the result is that there is lot of ugly boolean
flags all over the place.

Please take a look at the schema and post any thoughts you might
have...thanks!

Elias 
<?xml version="1.0"?>

<schema xmlns="http://www.w3.org/2001/XMLSchema";
  xmlns:esql="http://apache.org/cocoon/SQL/v2";
  targetNamespace="http://apache.org/cocoon/SQL/v2";
>
<annotation>
    <documentation>This schema describes a valid ESQL page.</documentation>
</annotation>

<complexType name="EsqlQuery">
    <annotation>
        <documentation>The SQL query to execute</documentation>
    </annotation>
    <sequence>
        <element name="esql:parameter" type="EsqlParameter" minOccurs="0" 
maxOccurs="unbounded"/>
    </sequence>
</complexType>
              
<simpleType name="EsqlParameter">
   <annotation>
     <documentation>A parameter for a prepared statement</documentation>
   </annotation>
  <restriction base="string"/>
</simpleType>

<simpleType name="EsqlColumnType">
    <restriction base="string">
        <enumeration value="string"/>
        <enumeration value="date"/>
        <enumeration value="time"/>
        <enumeration value="timestamp"/>
        <enumeration value="boolean"/>
        <enumeration value="double"/>
        <enumeration value="float"/>
        <enumeration value="int"/>
        <enumeration value="long"/>
        <enumeration value="short"/>
        <enumeration value="xml"/>
    </restriction>
</simpleType>

<complexType name="EsqlGetColumn">
    <annotation>
        <documentation>
        Parses the value of the given column in the current row as XML and returns it
        The given column is indicated by the column attribute. If the attribute's 
value is an integer, 
        it is treated as the index of the column in the row, otherwise it's value is 
treated as 
        the name of the column.
        </documentation>
    </annotation>
    <complexContent>
        <extension base="EsqlColumnFunction">
            <attribute name="column" type="string" use="required"/>
            <attribute name="asType" type="EsqlColumnType"/>
        </extension>
    </complexContent>
</complexType>

<simpleType name="EsqlFormattedColumnType">
    <restriction base="string">
        <enumeration value="date"/>
        <enumeration value="double"/>
        <enumeration value="float"/>
    </restriction>
</simpleType>

<complexType name="EsqlFormattedColumnFunction">
    <annotation>
        <documentation>The value of the format attribute can used by some column value 
functions (e.g. date, real) as a template for formatting the column value. This is 
necessarily implementation dependent.</documentation>
    </annotation>
    <complexContent>
        <extension base="EsqlColumnFunction">
            <attribute name="esql:format" type="string">
                <annotation><documentation>The format string, as in StringFormat 
class</documentation></annotation>
            </attribute>
            <attribute name="esql:encoding" type="string">
                <annotation><documentation>The string 
encoding</documentation></annotation>
            </attribute>
        </extension>
    </complexContent>
</complexType>

<complexType name="EsqlGetFormattedColumn">
    <annotation>
        <documentation>
        The given column is indicated by the column attribute. If the attribute's 
value is an integer, 
        it is treated as the index of the column in the row, otherwise it's value is 
treated as 
        the name of the column.
        </documentation>
    </annotation>
    <complexContent>
        <extension base="EsqlFormattedColumnFunction">
            <attribute name="column" type="string" use="required"/>
            <attribute name="asType" type="EsqlFormattedColumnType"/>
        </extension>
    </complexContent>
</complexType>

<complexType name="EsqlGetColumns">
    <annotation>
        <documentation>
        Returns a sequence of elements whose names are the current row's column names, 

        and whose values are the current row's column values
        </documentation>
    </annotation>
    <complexContent>
        <extension base="EsqlColumnFunction">
            <attribute name="esql:encoding" type="string"/>
        </extension>
    </complexContent>
</complexType>

<simpleType name="EsqlGetRowPosition">
  <annotation>
    <documentation>Returns the position of the current row in the 
resultset</documentation>
  </annotation>
  <restriction base="string"/>
</simpleType>

<simpleType name="EsqlGetColumnName">
  <annotation>
    <documentation>Returns the name of the given column in the current 
row</documentation>
  </annotation>
  <restriction base="string"/>
</simpleType>

<simpleType name="EsqlGetColumnLabel">
  <annotation>
    <documentation>Returns the label of the given column in the current 
row</documentation>
  </annotation>
  <restriction base="string"/>
</simpleType>

<simpleType name="EsqlGetColumnTypeName" >
  <annotation>
    <documentation>Returns the type name of the given column in the current 
row</documentation>
  </annotation>
  <restriction base="string"/>
</simpleType>

<simpleType name="EsqlNoResults">
  <annotation>
    <documentation>This simpleType's children are instantiated in the result tree for 
each row in the resultset</documentation>
  </annotation>
  <restriction base="string"/>
</simpleType>

<simpleType name="EsqlUpdateResults">
  <annotation>
    <documentation>This simpleType's children are instantiated in the result tree if 
the query returns a number of rows</documentation>
  </annotation>
  <restriction base="string"/>
</simpleType>

<simpleType name="EsqlErrorResults">
  <annotation>
    <documentation>This simpleType's children are instantiated in the result tree if 
the query results in a database error. If this simpleType does not exist, the error is 
passed on to the xsp layer. If it does exist, the error is caught here unless passed 
on explicitly.</documentation>
  </annotation>
  <restriction base="string"/>
</simpleType>

<complexType name="EsqlRowResults">
    <annotation>
        <documentation>This element's children are instantiated in the result tree for 
each row in the resultset</documentation>
    </annotation>
    <choice>
        <any namespace="##other" minOccurs="0" maxOccurs="unbounded" 
processContents="lax"/>
        <element name="esql:get-column" type="EsqlGetColumn" minOccurs="0" 
maxOccurs="unbounded"/>
        <element name="esql:get-columns" type="EsqlGetColumns" minOccurs="0" 
maxOccurs="1"/>
        <element name="esql:get-row-position" type="EsqlGetRowPosition" minOccurs="0" 
maxOccurs="unbounded"/>
        <element name="esql:get-column-name" type="EsqlGetColumnName" minOccurs="0" 
maxOccurs="unbounded"/>
        <element name="esql:get-column-label" type="EsqlGetColumnLabel" minOccurs="0" 
maxOccurs="unbounded"/>
        <element name="esql:get-column-type-name" type="EsqlGetColumnTypeName" 
minOccurs="0" maxOccurs="unbounded"/>
    </choice>
</complexType>

<complexType name="EsqlResults">
    <annotation>
        <documentation>This element's children are instantiated in the result tree 
when the query returns a resultset</documentation>
    </annotation>
    <sequence>
      <element name="esql:row-results" type="EsqlRowResults" minOccurs="0" 
maxOccurs="1"/>
      <element name="esql:no-results" type="EsqlNoResults" minOccurs="0" 
maxOccurs="1"/>
    </sequence>
</complexType>

<complexType name="EsqlExecuteQuery">
    <annotation>
        <documentation>Executes a query on the database</documentation>
    </annotation>
    <sequence>
        <element name="esql:query" type="EsqlQuery"/>
        <element name="esql:results" type="EsqlResults" minOccurs="0" maxOccurs="1"/>
        <element name="esql:update-results" type="EsqlUpdateResults" minOccurs="0" 
maxOccurs="1"/>
        <element name="esql:error-results" type="EsqlErrorResults" minOccurs="0" 
maxOccurs="1"/>
    </sequence>
</complexType>

<simpleType name="EsqlDriver">
    <annotation>
        <documentation>The name of the driver to use</documentation>
    </annotation>
    <restriction base="string"/>
</simpleType>

<simpleType name="EsqlDburl">
    <annotation>
      <documentation>The URL of the database</documentation>
    </annotation>
    <restriction base="string"/>
</simpleType>

<simpleType name="EsqlUsername">
    <annotation>
      <documentation>The database user's name</documentation>
    </annotation>
    <restriction base="string"/>
</simpleType>

<simpleType name="EsqlPassword">
    <annotation>
      <documentation>The database user's password</documentation>
    </annotation>
    <restriction base="string"/>
</simpleType>

<simpleType name="EsqlPool">
  <annotation>
    <documentation>The name of the database pool</documentation>
  </annotation>
  <restriction base="string"/>
</simpleType>

<complexType name="EsqlConnection">
  <annotation>
    <documentation>Opens a new database connection.</documentation>
  </annotation>
  <sequence>
    <choice>
        <sequence>
            <element name="esql:driver" type="EsqlDriver"/>
            <element name="esql:dburl" type="EsqlDburl"/>
            <element name="esql:username" type="EsqlUsername" minOccurs="0" 
maxOccurs="1"/>
            <element name="esql:password" type="EsqlPassword" minOccurs="0" 
maxOccurs="1"/>
        </sequence>
        <element name="esql:pool" type="EsqlPool"/>
      </choice>
      <element name="esql:execute-query" type="EsqlExecuteQuery" minOccurs="0" 
maxOccurs="unbounded"/>
    </sequence>
</complexType>

<!-- the root element of a ESQL logicsheet -->
<element name='esql:connection' type="EsqlConnection"/>

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

Reply via email to