Author: vgritsenko Date: Tue May 3 12:01:31 2005 New Revision: 167957 URL: http://svn.apache.org/viewcvs?rev=167957&view=rev Log: Remove duplicate HSQLDB database from databases block. Remove duplicate samples schema from databases block. Link samples to samples schema in hsqldb block. Fix namespaces in sql transformer example.
Removed: cocoon/blocks/unsupported/databases/trunk/build-special.xml cocoon/blocks/unsupported/databases/trunk/conf/cocoondb.properties cocoon/blocks/unsupported/databases/trunk/conf/cocoondb.script cocoon/blocks/unsupported/databases/trunk/samples/transform/sql-page.xml.sql Modified: cocoon/blocks/unsupported/databases/trunk/samples/mod-db/edit-groups.xsp cocoon/blocks/unsupported/databases/trunk/samples/mod-db/file-upload-blob.xsp cocoon/blocks/unsupported/databases/trunk/samples/mod-db/schema.sql cocoon/blocks/unsupported/databases/trunk/samples/mod-db/user-list.xsp cocoon/blocks/unsupported/databases/trunk/samples/org-db/add-department.xsp cocoon/blocks/unsupported/databases/trunk/samples/org-db/add-employee.xsp cocoon/blocks/unsupported/databases/trunk/samples/org-db/employee.xsp cocoon/blocks/unsupported/databases/trunk/samples/org-db/process-department.xsp cocoon/blocks/unsupported/databases/trunk/samples/org-db/process-employee.xsp cocoon/blocks/unsupported/databases/trunk/samples/org-db/sitemap.xmap cocoon/blocks/unsupported/databases/trunk/samples/sitemap.xmap cocoon/blocks/unsupported/databases/trunk/samples/stylesheets/sql2html.xsl cocoon/blocks/unsupported/databases/trunk/samples/transform/sitemap.xmap cocoon/blocks/unsupported/databases/trunk/samples/transform/sql-page.xml cocoon/blocks/unsupported/databases/trunk/samples/xsp/esql.xsp Modified: cocoon/blocks/unsupported/databases/trunk/samples/mod-db/edit-groups.xsp URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/databases/trunk/samples/mod-db/edit-groups.xsp?rev=167957&r1=167956&r2=167957&view=diff ============================================================================== --- cocoon/blocks/unsupported/databases/trunk/samples/mod-db/edit-groups.xsp (original) +++ cocoon/blocks/unsupported/databases/trunk/samples/mod-db/edit-groups.xsp Tue May 3 12:01:31 2005 @@ -15,32 +15,29 @@ limitations under the License. --> -<xsp:page - language="java" +<xsp:page language="java" xmlns:xsp="http://apache.org/xsp" - xmlns:esql="http://apache.org/cocoon/SQL/v2" - xmlns:xsp-request="http://apache.org/xsp/request/2.0" - > - <!-- - --> + xmlns:esql="http://apache.org/cocoon/SQL/v2" + xmlns:xsp-request="http://apache.org/xsp/request/2.0"> + <xsp:structure> <xsp:include>java.util.Enumeration</xsp:include> </xsp:structure> - + <page> <resources> <resource type="file" href="database.xml?cocoon-view=pretty-content">Descriptor</resource> - <resource type="file" href="schema.sql">Schema</resource> + <resource type="file" href="../schema.sql">Schema</resource> <resource type="doc" href="userdocs/actions/database-actions.html">Actions</resource> <resource type="doc" href="userdocs/xsp/esql.html">ESQL</resource> </resources> <title>edit-groups</title> - + <esql:connection> <esql:pool>personnel</esql:pool> - + <xsp:logic> String user = <xsp-request:get-parameter name="user.uid"/>; if ( user == null ) { @@ -71,7 +68,7 @@ </esql:row-results> </esql:results> </esql:execute-query> - } + } </xsp:logic> @@ -129,7 +126,7 @@ <esql:query>select gid, gname from user_groups, groups where user_groups.gid = groups.gid and uid=<esql:parameter type="int"><xsp:expr>uid</xsp:expr></esql:parameter> order by gname</esql:query> <esql:results> <esql:row-results> - <option> + <option> <xsp:attribute name="value"><esql:get-string column="gid"/></xsp:attribute> <esql:get-string column="gname"/> </option> @@ -173,7 +170,7 @@ <esql:query>select gid, gname from groups where gid not in (select gid from user_groups where uid=<esql:parameter type="int"><xsp:expr>uid</xsp:expr></esql:parameter>) order by gname</esql:query> <esql:results> <esql:row-results> - <option> + <option> <xsp:attribute name="value"><esql:get-string column="gid"/></xsp:attribute> <esql:get-string column="gname"/> </option> Modified: cocoon/blocks/unsupported/databases/trunk/samples/mod-db/file-upload-blob.xsp URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/databases/trunk/samples/mod-db/file-upload-blob.xsp?rev=167957&r1=167956&r2=167957&view=diff ============================================================================== --- cocoon/blocks/unsupported/databases/trunk/samples/mod-db/file-upload-blob.xsp (original) +++ cocoon/blocks/unsupported/databases/trunk/samples/mod-db/file-upload-blob.xsp Tue May 3 12:01:31 2005 @@ -24,11 +24,11 @@ <xsp:structure> <xsp:include>java.util.Enumeration</xsp:include> </xsp:structure> - + <page> <resources> <resource type="file" href="database.xml?cocoon-view=pretty-content">Descriptor</resource> - <resource type="file" href="schema.sql">Schema</resource> + <resource type="file" href="../schema.sql">Schema</resource> <resource type="doc" href="userdocs/actions/database-actions.html">Actions</resource> <resource type="doc" href="userdocs/xsp/esql.html">ESQL</resource> </resources> @@ -36,12 +36,12 @@ <title>file-upload-blob</title> <!-- create image tags out of the images stored in the database, the browser will subsequently - request those images and they will be served by a special pipeline in the sitemap using + request those images and they will be served by a special pipeline in the sitemap using the database reader component - --> + --> <esql:connection> <esql:pool>personnel</esql:pool> - + <esql:execute-query> <esql:query>select media.id from media</esql:query> <esql:results> @@ -53,17 +53,17 @@ <esql:no-results>no images yet</esql:no-results> </esql:execute-query> </esql:connection> - + <h1>Upload Media</h1> - <p>What's happening? This example interacts with a simple database schema, set up by - default in the sample "personnel" hsql database installed with the database block. There - is one table "media" with two fields: a primary key, and a binary field "image". - When a file upload is received from the simple form on this page, the modular db action + <p>What's happening? This example interacts with a simple database schema, set up by + default in the sample "personnel" hsql database installed with the database block. There + is one table "media" with two fields: a primary key, and a binary field "image". + When a file upload is received from the simple form on this page, the modular db action auto increments the primary key, and loads the binary file contents into the column (declared as type="binary" in database.xml). That's it.</p> - <p>Additionally, when this page is loaded, esql queries the media table and places an image tag - for each row, using "primarykeyvalue".jpg for the src. The sitemap is configured to serve + <p>Additionally, when this page is loaded, esql queries the media table and places an image tag + for each row, using "primarykeyvalue".jpg for the src. The sitemap is configured to serve *.jpg using the database reader (declared in the root database samples sitemap) which simply retrieves the binary data from the database and streams it to the browser.</p> Modified: cocoon/blocks/unsupported/databases/trunk/samples/mod-db/schema.sql URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/databases/trunk/samples/mod-db/schema.sql?rev=167957&r1=167956&r2=167957&view=diff ============================================================================== --- cocoon/blocks/unsupported/databases/trunk/samples/mod-db/schema.sql (original) +++ cocoon/blocks/unsupported/databases/trunk/samples/mod-db/schema.sql Tue May 3 12:01:31 2005 @@ -1,5 +1,3 @@ - - # Copyright 1999-2004 The Apache Software Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -47,4 +45,3 @@ mimetype varchar(50), primary key (id) ); - Modified: cocoon/blocks/unsupported/databases/trunk/samples/mod-db/user-list.xsp URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/databases/trunk/samples/mod-db/user-list.xsp?rev=167957&r1=167956&r2=167957&view=diff ============================================================================== --- cocoon/blocks/unsupported/databases/trunk/samples/mod-db/user-list.xsp (original) +++ cocoon/blocks/unsupported/databases/trunk/samples/mod-db/user-list.xsp Tue May 3 12:01:31 2005 @@ -16,32 +16,28 @@ --> <xsp:page language="java" - xmlns:xsp="http://apache.org/xsp" - xmlns:esql="http://apache.org/cocoon/SQL/v2" - xmlns:xsp-request="http://apache.org/xsp/request/2.0" -> + xmlns:xsp="http://apache.org/xsp" + xmlns:esql="http://apache.org/cocoon/SQL/v2" + xmlns:xsp-request="http://apache.org/xsp/request/2.0"> <xsp:structure> <xsp:include>java.util.Enumeration</xsp:include> </xsp:structure> - - <page> + <page> <resources> <resource type="file" href="database.xml?cocoon-view=pretty-content">Descriptor</resource> - <resource type="file" href="schema.sql">Schema</resource> + <resource type="file" href="../schema.sql">Schema</resource> <resource type="doc" href="userdocs/actions/database-actions.html">Actions</resource> <resource type="doc" href="userdocs/xsp/esql.html">ESQL</resource> </resources> <title>user-list</title> - - <content> - - <h1>Modular Database Actions</h1> + <content> + <h1>Modular Database Actions</h1> - <hr/> + <hr/> <p>The intention is to factor out those parts that are dependent on the utilised DBMS as well as the methods used to obtain the values @@ -50,7 +46,7 @@ <ol> <li>Input Modules read data from some source (e.g. the request - object or session attributes or whatever)</li> + object or session attributes or whatever)</li> <li>Output Modules send the data to an arbitrary destination. Again, this could be request attributes or @@ -71,16 +67,16 @@ <h2>Current database content</h2> - <esql:connection> + <esql:connection> <esql:pool>personnel</esql:pool> - + <p> <sqltbl> <esql:execute-query> <esql:query>select * from user order by name, firstname, uname, uid</esql:query> <esql:results> <esql:row-results> - + <sqltblrow> <name> <esql:get-string column="name"/> @@ -106,7 +102,7 @@ </form> </action> </sqltblrow> - + </esql:row-results> </esql:results> <esql:error-results> @@ -136,7 +132,7 @@ <esql:query>select gid, gname from groups order by gname</esql:query> <esql:results> <esql:row-results> - <option> + <option> <xsp:attribute name="value"><esql:get-string column="gid"/></xsp:attribute> <esql:get-string column="gname"/> </option> @@ -146,7 +142,7 @@ </select> <input type="submit" name="add-user-groups" value="new user"/> </action> - </sqltblrow> + </sqltblrow> </form> </sqltbl> </p> @@ -221,7 +217,7 @@ </form> </p> </esql:connection> - + <hr/> @@ -268,7 +264,7 @@ </p> <hr/> - + </content> </page> </xsp:page> Modified: cocoon/blocks/unsupported/databases/trunk/samples/org-db/add-department.xsp URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/databases/trunk/samples/org-db/add-department.xsp?rev=167957&r1=167956&r2=167957&view=diff ============================================================================== --- cocoon/blocks/unsupported/databases/trunk/samples/org-db/add-department.xsp (original) +++ cocoon/blocks/unsupported/databases/trunk/samples/org-db/add-department.xsp Tue May 3 12:01:31 2005 @@ -15,28 +15,24 @@ limitations under the License. --> -<xsp:page - language="java" - xmlns:xsp="http://apache.org/xsp" -> - +<xsp:page language="java" + xmlns:xsp="http://apache.org/xsp"> <page> - <resources> - <resource type="file" href="employee.xml?cocoon-view=pretty-content">Descriptor</resource> - <resource type="file" href="../transform/sql-page.xml.sql">Schema</resource> - <resource type="doc" href="userdocs/actions/database-actions.html">Actions</resource> - <resource type="doc" href="userdocs/xsp/esql.html">ESQL</resource> + <resource type="file" href="employee.xml?cocoon-view=pretty-content">Descriptor</resource> + <resource type="file" href="../schema.sql">Schema</resource> + <resource type="doc" href="userdocs/actions/database-actions.html">Actions</resource> + <resource type="doc" href="userdocs/xsp/esql.html">ESQL</resource> </resources> - <title>Add a Department</title> + <title>Add a Department</title> - <content> - <form action="process-department" method="POST"> - <input name="process" type="hidden" value="Add"/> - <para>Department Name: <input name="name" type="text"/></para> - <input type="submit" value="Add"/> - </form> - </content> + <content> + <form action="process-department" method="POST"> + <input name="process" type="hidden" value="Add"/> + <para>Department Name: <input name="name" type="text"/></para> + <input type="submit" value="Add"/> + </form> + </content> </page> </xsp:page> Modified: cocoon/blocks/unsupported/databases/trunk/samples/org-db/add-employee.xsp URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/databases/trunk/samples/org-db/add-employee.xsp?rev=167957&r1=167956&r2=167957&view=diff ============================================================================== --- cocoon/blocks/unsupported/databases/trunk/samples/org-db/add-employee.xsp (original) +++ cocoon/blocks/unsupported/databases/trunk/samples/org-db/add-employee.xsp Tue May 3 12:01:31 2005 @@ -15,41 +15,39 @@ limitations under the License. --> -<xsp:page - language="java" +<xsp:page language="java" xmlns:xsp="http://apache.org/xsp" - xmlns:esql="http://apache.org/cocoon/SQL/v2" -> + xmlns:esql="http://apache.org/cocoon/SQL/v2"> <page> - <resources> - <resource type="file" href="employee.xml?cocoon-view=pretty-content">Descriptor</resource> - <resource type="file" href="../transform/sql-page.xml.sql">Schema</resource> - <resource type="doc" href="userdocs/actions/database-actions.html">Actions</resource> - <resource type="doc" href="userdocs/xsp/esql.html">ESQL</resource> + <resource type="file" href="employee.xml?cocoon-view=pretty-content">Descriptor</resource> + <resource type="file" href="../schema.sql">Schema</resource> + <resource type="doc" href="userdocs/actions/database-actions.html">Actions</resource> + <resource type="doc" href="userdocs/xsp/esql.html">ESQL</resource> </resources> <title>Add an Employee</title> + <content> <form action="process-employee" method="POST"> <input name="process" type="hidden" value="Add"/> <para>Employee Name: <input name="name" type="text"/></para> <para>Department: <select name="department"> - <esql:connection> - <esql:pool>personnel</esql:pool> - <esql:execute-query> - <esql:query>select id, name from department order by name</esql:query> - <esql:results> - <esql:row-results> - <option> - <xsp:attribute name="value"><esql:get-int column="id"/></xsp:attribute> - <esql:get-string column="name"/> - </option> - </esql:row-results> - </esql:results> - </esql:execute-query> - </esql:connection> + <esql:connection> + <esql:pool>personnel</esql:pool> + <esql:execute-query> + <esql:query>select id, name from department order by name</esql:query> + <esql:results> + <esql:row-results> + <option> + <xsp:attribute name="value"><esql:get-int column="id"/></xsp:attribute> + <esql:get-string column="name"/> + </option> + </esql:row-results> + </esql:results> + </esql:execute-query> + </esql:connection> </select> </para> <input type="submit" value="Add"/> Modified: cocoon/blocks/unsupported/databases/trunk/samples/org-db/employee.xsp URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/databases/trunk/samples/org-db/employee.xsp?rev=167957&r1=167956&r2=167957&view=diff ============================================================================== --- cocoon/blocks/unsupported/databases/trunk/samples/org-db/employee.xsp (original) +++ cocoon/blocks/unsupported/databases/trunk/samples/org-db/employee.xsp Tue May 3 12:01:31 2005 @@ -15,11 +15,9 @@ limitations under the License. --> -<xsp:page - language="java" +<xsp:page language="java" xmlns:xsp="http://apache.org/xsp" - xmlns:esql="http://apache.org/cocoon/SQL/v2" -> + xmlns:esql="http://apache.org/cocoon/SQL/v2"> <page> <xsp:logic> String empID = request.getParameter("employee"); @@ -29,52 +27,53 @@ </xsp:logic> <resources> - <resource type="file" href="employee.xml?cocoon-view=pretty-content">Descriptor</resource> - <resource type="file" href="../transform/sql-page.xml.sql">Schema</resource> - <resource type="doc" href="userdocs/actions/database-actions.html">Actions</resource> - <resource type="doc" href="userdocs/xsp/esql.html">ESQL</resource> + <resource type="file" href="employee.xml?cocoon-view=pretty-content">Descriptor</resource> + <resource type="file" href="../schema.sql">Schema</resource> + <resource type="doc" href="userdocs/actions/database-actions.html">Actions</resource> + <resource type="doc" href="userdocs/xsp/esql.html">ESQL</resource> </resources> <title>Manage Employees</title> <para style="backgroud-color:#ff0000"><xsp:expr>(message == null?"":message)</xsp:expr></para> <content> <form name="EmployeeSelection"> - <select size="1" name="employee" - onChange="top.location.href=window.location.pathname + '?employee=' + document.forms['EmployeeSelection'].employee.options[document.forms['EmployeeSelection'].employee.options.selectedIndex].value"> - <option value="-1">-- New employee --</option> - <esql:connection> - <esql:pool>personnel</esql:pool> - <esql:execute-query> - <esql:query>select id, department_id, name from employee order by name</esql:query> - <esql:results> - <esql:row-results> - <xsp:logic> + <select size="1" name="employee" + onChange="top.location.href=window.location.pathname + '?employee=' + document.forms['EmployeeSelection'].employee.options[document.forms['EmployeeSelection'].employee.options.selectedIndex].value"> + <option value="-1">-- New employee --</option> + <esql:connection> + <esql:pool>personnel</esql:pool> + <esql:execute-query> + <esql:query>select id, department_id, name from employee order by name</esql:query> + <esql:results> + <esql:row-results> + <xsp:logic> if (<esql:get-string column="id"/>.equals(empID)) { depID = <esql:get-string column="department_id"/>; - name = <esql:get-string column="name"/>; - xspAttr.addAttribute("", "selected", "selected", "CDATA", ""); + name = <esql:get-string column="name"/>; + xspAttr.addAttribute("", "selected", "selected", "CDATA", ""); } - </xsp:logic> - <option> - <xsp:attribute name="value"><esql:get-int column="id"/></xsp:attribute> - <esql:get-string column="name"/> - </option> - </esql:row-results> - </esql:results> - </esql:execute-query> - </esql:connection> - </select> + </xsp:logic> + <option> + <xsp:attribute name="value"><esql:get-int column="id"/></xsp:attribute> + <esql:get-string column="name"/> + </option> + </esql:row-results> + </esql:results> + </esql:execute-query> + </esql:connection> + </select> </form> + <form action="" method="POST" name="EmployeeEntry"> <script>document.forms["EmployeeEntry"].action = window.location.pathname</script> <input type="hidden" name="employee"> - <xsp:attribute name="value"><xsp:expr>((empID != null) ? empID : "")</xsp:expr></xsp:attribute> - </input> + <xsp:attribute name="value"><xsp:expr>((empID != null) ? empID : "")</xsp:expr></xsp:attribute> + </input> <para>Employee Name: - <input name="name" type="text"> - <xsp:attribute name="value"><xsp:expr>((name != null) ? name : "")</xsp:expr></xsp:attribute> - </input> - </para> + <input name="name" type="text"> + <xsp:attribute name="value"><xsp:expr>((name != null) ? name : "")</xsp:expr></xsp:attribute> + </input> + </para> <para>Department: <select name="department"> <option value="-1">-- Select department --</option> @@ -84,11 +83,11 @@ <esql:query>select id, name from department order by name</esql:query> <esql:results> <esql:row-results> - <xsp:logic> + <xsp:logic> if (<esql:get-string column="id"/>.equals(depID)) { - xspAttr.addAttribute("", "selected", "selected", "CDATA", ""); + xspAttr.addAttribute("", "selected", "selected", "CDATA", ""); } - </xsp:logic> + </xsp:logic> <option> <xsp:attribute name="value"><esql:get-int column="id"/></xsp:attribute> <esql:get-string column="name"/> Modified: cocoon/blocks/unsupported/databases/trunk/samples/org-db/process-department.xsp URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/databases/trunk/samples/org-db/process-department.xsp?rev=167957&r1=167956&r2=167957&view=diff ============================================================================== --- cocoon/blocks/unsupported/databases/trunk/samples/org-db/process-department.xsp (original) +++ cocoon/blocks/unsupported/databases/trunk/samples/org-db/process-department.xsp Tue May 3 12:01:31 2005 @@ -15,17 +15,17 @@ limitations under the License. --> -<xsp:page - language="java" +<xsp:page language="java" xmlns:xsp="http://apache.org/xsp" xmlns:esql="http://apache.org/cocoon/SQL/v2" - xmlns:xsp-request="http://apache.org/xsp/request/2.0" -> + xmlns:xsp-request="http://apache.org/xsp/request/2.0"> + <xsp:logic> String process = null; String name = null; int currId = -1; </xsp:logic> + <page> <xsp:logic> process = <xsp-request:get-parameter name="process"/>; @@ -33,10 +33,10 @@ </xsp:logic> <resources> - <resource type="file" href="employee.xml?cocoon-view=pretty-content">Descriptor</resource> - <resource type="file" href="../transform/sql-page.xml.sql">Schema</resource> - <resource type="doc" href="userdocs/actions/database-actions.html">Actions</resource> - <resource type="doc" href="userdocs/xsp/esql.html">ESQL</resource> + <resource type="file" href="employee.xml?cocoon-view=pretty-content">Descriptor</resource> + <resource type="file" href="../schema.sql">Schema</resource> + <resource type="doc" href="userdocs/actions/database-actions.html">Actions</resource> + <resource type="doc" href="userdocs/xsp/esql.html">ESQL</resource> </resources> <title><xsp:expr>process</xsp:expr> Department Processed</title> @@ -45,13 +45,13 @@ <esql:pool>personnel</esql:pool> <esql:execute-query> <esql:query> - select max(id) as maxid from department - </esql:query> + select max(id) as maxid from department + </esql:query> <esql:results> - <esql:row-results> - <xsp:logic> + <esql:row-results> + <xsp:logic> currId = <esql:get-int column="maxid"/>; - </xsp:logic> + </xsp:logic> <esql:execute-query> <esql:query> insert into department (id, name) values ( @@ -60,7 +60,7 @@ ) </esql:query> </esql:execute-query> - </esql:row-results> + </esql:row-results> </esql:results> </esql:execute-query> </esql:connection> Modified: cocoon/blocks/unsupported/databases/trunk/samples/org-db/process-employee.xsp URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/databases/trunk/samples/org-db/process-employee.xsp?rev=167957&r1=167956&r2=167957&view=diff ============================================================================== --- cocoon/blocks/unsupported/databases/trunk/samples/org-db/process-employee.xsp (original) +++ cocoon/blocks/unsupported/databases/trunk/samples/org-db/process-employee.xsp Tue May 3 12:01:31 2005 @@ -15,18 +15,18 @@ limitations under the License. --> -<xsp:page - language="java" +<xsp:page language="java" xmlns:xsp="http://apache.org/xsp" xmlns:esql="http://apache.org/cocoon/SQL/v2" - xmlns:xsp-request="http://apache.org/xsp/request/2.0" -> + xmlns:xsp-request="http://apache.org/xsp/request/2.0"> + <xsp:logic> String process = null; String name = null; String departmentId = null; int currId = -1; </xsp:logic> + <page> <xsp:logic> process = <xsp-request:get-parameter name="process"/>; @@ -35,34 +35,34 @@ </xsp:logic> <resources> - <resource type="file" href="employee.xml?cocoon-view=pretty-content">Descriptor</resource> - <resource type="file" href="../transform/sql-page.xml.sql">Schema</resource> - <resource type="doc" href="userdocs/actions/database-actions.html">Actions</resource> - <resource type="doc" href="userdocs/xsp/esql.html">ESQL</resource> + <resource type="file" href="employee.xml?cocoon-view=pretty-content">Descriptor</resource> + <resource type="file" href="../schema.sql">Schema</resource> + <resource type="doc" href="userdocs/actions/database-actions.html">Actions</resource> + <resource type="doc" href="userdocs/xsp/esql.html">ESQL</resource> </resources> <title><xsp:expr>process</xsp:expr> Employee Processed</title> <content> <esql:connection> <esql:pool>personnel</esql:pool> - <esql:autocommit>false</esql:autocommit> + <esql:autocommit>false</esql:autocommit> <esql:execute-query> <esql:query>select max(id) as maxid from employee</esql:query> <esql:results> - <esql:row-results> - <xsp:logic> + <esql:row-results> + <xsp:logic> currId = <esql:get-int column="maxid"/>; - </xsp:logic> + </xsp:logic> <esql:execute-query> <esql:query> insert into employee (id, name, department_id) values ( (<esql:parameter><xsp:expr>currId + 1</xsp:expr></esql:parameter>), - <esql:parameter><xsp:expr>name</xsp:expr></esql:parameter>, - <esql:parameter><xsp:expr>departmentId</xsp:expr></esql:parameter> + <esql:parameter><xsp:expr>name</xsp:expr></esql:parameter>, + <esql:parameter><xsp:expr>departmentId</xsp:expr></esql:parameter> ) </esql:query> </esql:execute-query> - </esql:row-results> + </esql:row-results> </esql:results> </esql:execute-query> </esql:connection> Modified: cocoon/blocks/unsupported/databases/trunk/samples/org-db/sitemap.xmap URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/databases/trunk/samples/org-db/sitemap.xmap?rev=167957&r1=167956&r2=167957&view=diff ============================================================================== --- cocoon/blocks/unsupported/databases/trunk/samples/org-db/sitemap.xmap (original) +++ cocoon/blocks/unsupported/databases/trunk/samples/org-db/sitemap.xmap Tue May 3 12:01:31 2005 @@ -14,107 +14,103 @@ See the License for the specific language governing permissions and limitations under the License. --> + <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> -<!-- ========================= Components ================================ --> + <!-- ========================= Components ================================ --> - <map:components> - <!-- original database actions --> - <map:actions> - <map:action logger="sitemap.action.add-employee" name="add-employee" src="org.apache.cocoon.acting.DatabaseAddAction"/> - <map:action logger="sitemap.action.del-employee" name="del-employee" src="org.apache.cocoon.acting.DatabaseDeleteAction"/> - <map:action logger="sitemap.action.upd-employee" name="upd-employee" src="org.apache.cocoon.acting.DatabaseUpdateAction"/> - </map:actions> - - </map:components> - - -<!-- ========================== Action sets ================================ --> - -<!-- - Action sets group actions together. If some actions are often used - together in pipeline fragments, it's easier to group them and refer - to the group. For more info, please see the docs. ---> - - <map:action-sets> - <map:action-set name="employee"> - <map:act action="Add" type="add-employee"/> - <map:act action="Delete" type="del-employee"/> - <map:act action="Update" type="upd-employee"/> - </map:action-set> - </map:action-sets> - -<!-- ============================ Views ==================================== --> - - <map:views> - <map:view name="content" from-label="content"> - <map:serialize type="xml"/> - </map:view> - - <map:view from-label="content" name="pretty-content"> - <map:transform src="context://stylesheets/system/xml2html.xslt"/> - <map:serialize type="html"/> - </map:view> - - <map:view name="links" from-position="last"> - <map:serialize type="links"/> - </map:view> - - </map:views> - -<!-- =========================== Pipelines ================================= --> - - <map:pipelines> - - <map:pipeline> - - <map:match pattern="employee.xml"> - <map:generate src="{0}"/> - <map:serialize type="xml"/> - </map:match> - - <map:match pattern="employee"> - <map:act set="employee"> - <map:parameter name="descriptor" value="employee.xml"/> - <!-- - Here an action is used. To be precise: all actions that were - grouped together to a set named "employee". See user docs on - actions for more on this. - - This fragment until the closing tag of map:act is only - included if at least one action of this set completes - successfully. - --> - <map:generate src="employee.xsp" type="serverpages"/> - <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl"> - <map:parameter name="servletPath" value="{request:servletPath}"/> - <map:parameter name="sitemapURI" value="{request:sitemapURI}"/> - <map:parameter name="contextPath" value="{request:contextPath}"/> - <map:parameter name="file" value=".xsp"/> - </map:transform> - <map:serialize/> - </map:act> - </map:match> - - <map:match pattern="*"> - <map:generate src="{1}.xsp" type="serverpages"/> - <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl"> + <map:components> + <map:actions> + <!-- + - Original database actions + --> + <map:action logger="sitemap.action.add-employee" name="add-employee" src="org.apache.cocoon.acting.DatabaseAddAction"/> + <map:action logger="sitemap.action.del-employee" name="del-employee" src="org.apache.cocoon.acting.DatabaseDeleteAction"/> + <map:action logger="sitemap.action.upd-employee" name="upd-employee" src="org.apache.cocoon.acting.DatabaseUpdateAction"/> + </map:actions> + </map:components> + + <!-- ========================== Action sets ================================ --> + + <!-- + - Action sets group actions together. If some actions are often used + - together in pipeline fragments, it's easier to group them and refer + - to the group. For more info, please see the docs. + --> + <map:action-sets> + <map:action-set name="employee"> + <map:act action="Add" type="add-employee"/> + <map:act action="Delete" type="del-employee"/> + <map:act action="Update" type="upd-employee"/> + </map:action-set> + </map:action-sets> + + <!-- ============================ Views ==================================== --> + + <map:views> + <map:view name="content" from-label="content"> + <map:serialize type="xml"/> + </map:view> + + <map:view from-label="content" name="pretty-content"> + <map:transform src="context://stylesheets/system/xml2html.xslt"/> + <map:serialize type="html"/> + </map:view> + + <map:view name="links" from-position="last"> + <map:serialize type="links"/> + </map:view> + </map:views> + + <!-- =========================== Pipelines ================================= --> + + <map:pipelines> + <map:pipeline> + + <map:match pattern="employee.xml"> + <map:generate src="{0}"/> + <map:serialize type="xml"/> + </map:match> + + <map:match pattern="employee"> + <map:act set="employee"> + <map:parameter name="descriptor" value="employee.xml"/> + <!-- + - Here an action is used. To be precise: all actions that were + - grouped together to a set named "employee". See user docs on + - actions for more on this. + - + - This fragment until the closing tag of map:act is only + - included if at least one action of this set completes + - successfully. + --> + <map:generate src="employee.xsp" type="serverpages"/> + <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl"> + <map:parameter name="servletPath" value="{request:servletPath}"/> + <map:parameter name="sitemapURI" value="{request:sitemapURI}"/> + <map:parameter name="contextPath" value="{request:contextPath}"/> + <map:parameter name="file" value=".xsp"/> + </map:transform> + <map:serialize/> + </map:act> + </map:match> + + <map:match pattern="*"> + <map:generate src="{1}.xsp" type="serverpages"/> + <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl"> <map:parameter name="servletPath" value="{request:servletPath}"/> <map:parameter name="sitemapURI" value="{request:sitemapURI}"/> <map:parameter name="contextPath" value="{request:contextPath}"/> <map:parameter name="file" value=".xsp"/> - </map:transform> - <map:serialize/> - </map:match> - - <map:match pattern=""> - <map:redirect-to uri="../"/> - </map:match> + </map:transform> + <map:serialize/> + </map:match> + + <map:match pattern=""> + <map:redirect-to uri="../"/> + </map:match> - </map:pipeline> - </map:pipelines> + </map:pipeline> + </map:pipelines> </map:sitemap> - -<!-- end of file --> Modified: cocoon/blocks/unsupported/databases/trunk/samples/sitemap.xmap URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/databases/trunk/samples/sitemap.xmap?rev=167957&r1=167956&r2=167957&view=diff ============================================================================== --- cocoon/blocks/unsupported/databases/trunk/samples/sitemap.xmap (original) +++ cocoon/blocks/unsupported/databases/trunk/samples/sitemap.xmap Tue May 3 12:01:31 2005 @@ -19,63 +19,64 @@ <!-- ========================= Components ================================ --> - <map:components> - <map:readers default="resource"> - <map:reader name="databasereader" logger="sitemap.reader.databasereader" - src="org.apache.cocoon.reading.DatabaseReader"> - <use-connection>personnel</use-connection> - </map:reader> - </map:readers> - </map:components> - -<!-- =========================== Views =================================== --> - - <map:views> - <map:view name="content" from-label="content"> - <map:serialize type="xml"/> - </map:view> - - <map:view from-label="content" name="pretty-content"> - <map:transform src="context://stylesheets/system/xml2html.xslt"/> - <map:serialize type="html"/> - </map:view> - - <map:view name="links" from-position="last"> - <map:serialize type="links"/> - </map:view> - - </map:views> - -<!-- =========================== Pipelines ================================= --> - - <map:pipelines> - - <map:pipeline> - - <map:match pattern=""> - <map:redirect-to uri="samples"/> - </map:match> - - <map:match pattern="welcome"> - <map:redirect-to uri="samples"/> - </map:match> - - <map:match pattern="samples"> - <map:generate src="samples.xml"/> - <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl"> - <map:parameter name="contextPath" value="{request:contextPath}"/> - </map:transform> - <map:serialize/> - </map:match> - - <!-- samples automount --> - <map:match pattern="*/**"> - <map:mount uri-prefix="{1}" src="{1}/" check-reload="yes"/> - </map:match> - - </map:pipeline> - </map:pipelines> + <map:components> + <map:readers default="resource"> + <map:reader name="databasereader" + logger="sitemap.reader.databasereader" + src="org.apache.cocoon.reading.DatabaseReader"> + <use-connection>personnel</use-connection> + </map:reader> + </map:readers> + </map:components> + + <!-- =========================== Views =================================== --> + + <map:views> + <map:view name="content" from-label="content"> + <map:serialize type="xml"/> + </map:view> + + <map:view from-label="content" name="pretty-content"> + <map:transform src="context://stylesheets/system/xml2html.xslt"/> + <map:serialize type="html"/> + </map:view> + + <map:view name="links" from-position="last"> + <map:serialize type="links"/> + </map:view> + </map:views> + + <!-- =========================== Pipelines ================================= --> + + <map:pipelines> + <map:pipeline> + + <map:match pattern=""> + <map:redirect-to uri="samples"/> + </map:match> + + <map:match pattern="welcome"> + <map:redirect-to uri="samples"/> + </map:match> + + <map:match pattern="schema.sql"> + <map:read src="context://WEB-INF/db/schema.sql" mime-type="text/plain"/> + </map:match> + + <map:match pattern="samples"> + <map:generate src="samples.xml"/> + <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl"> + <map:parameter name="contextPath" value="{request:contextPath}"/> + </map:transform> + <map:serialize/> + </map:match> + + <!-- samples automount --> + <map:match pattern="*/**"> + <map:mount uri-prefix="{1}" src="{1}/" check-reload="yes"/> + </map:match> -</map:sitemap> + </map:pipeline> + </map:pipelines> -<!-- end of file --> +</map:sitemap> Modified: cocoon/blocks/unsupported/databases/trunk/samples/stylesheets/sql2html.xsl URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/databases/trunk/samples/stylesheets/sql2html.xsl?rev=167957&r1=167956&r2=167957&view=diff ============================================================================== --- cocoon/blocks/unsupported/databases/trunk/samples/stylesheets/sql2html.xsl (original) +++ cocoon/blocks/unsupported/databases/trunk/samples/stylesheets/sql2html.xsl Tue May 3 12:01:31 2005 @@ -15,43 +15,52 @@ limitations under the License. --> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:sql="http://apache.org/cocoon/SQL/2.0"> - +<!-- + - Transforms sql transformer output into html. + - @version $Id$ + --> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:sql="http://apache.org/cocoon/SQL/2.0"> <xsl:import href="../../../common/style/xsl/html/simple-page2html.xsl"/> <xsl:template match="sql:rowset"> - <xsl:choose> - <xsl:when test="ancestor::sql:rowset"> - <tr> - <td> - <table border="1"> - <xsl:apply-templates/> - </table> - </td> - </tr> - </xsl:when> - <xsl:otherwise> - <table border="1"> - <xsl:apply-templates/> - </table> - </xsl:otherwise> - </xsl:choose> + <xsl:choose> + <xsl:when test="ancestor::sql:rowset"> + <tr> + <td> + <table border="1"> + <xsl:apply-templates/> + </table> + </td> + </tr> + </xsl:when> + <xsl:otherwise> + <table border="1"> + <xsl:apply-templates/> + </table> + </xsl:otherwise> + </xsl:choose> </xsl:template> <xsl:template match="sql:row"> - <tr> - <xsl:apply-templates/> - </tr> + <tr> + <xsl:apply-templates/> + </tr> </xsl:template> <xsl:template match="sql:name"> - <td><xsl:value-of select="."/></td> + <td> + <xsl:value-of select="."/> + <br/> + <xsl:copy-of select="../sql:description/*"/> + </td> </xsl:template> + <xsl:template match="sql:description"/> + <xsl:template match="sql:id"> - <!-- ignore --> + <!-- ignore --> </xsl:template> - </xsl:stylesheet> Modified: cocoon/blocks/unsupported/databases/trunk/samples/transform/sitemap.xmap URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/databases/trunk/samples/transform/sitemap.xmap?rev=167957&r1=167956&r2=167957&view=diff ============================================================================== --- cocoon/blocks/unsupported/databases/trunk/samples/transform/sitemap.xmap (original) +++ cocoon/blocks/unsupported/databases/trunk/samples/transform/sitemap.xmap Tue May 3 12:01:31 2005 @@ -18,59 +18,51 @@ <!-- ============================ Views ==================================== --> - <map:views> - <map:view name="content" from-label="content"> - <map:serialize type="xml"/> - </map:view> - - <map:view from-label="content" name="pretty-content"> - <map:transform src="context://stylesheets/system/xml2html.xslt"/> - <map:serialize type="html"/> - </map:view> - - <map:view name="links" from-position="last"> - <map:serialize type="links"/> - </map:view> - - </map:views> + <map:views> + <map:view name="content" from-label="content"> + <map:serialize type="xml"/> + </map:view> + + <map:view from-label="content" name="pretty-content"> + <map:transform src="context://stylesheets/system/xml2html.xslt"/> + <map:serialize type="html"/> + </map:view> + + <map:view name="links" from-position="last"> + <map:serialize type="links"/> + </map:view> + </map:views> <!-- =========================== Pipelines ================================= --> - <map:pipelines> + <map:pipelines> - <map:pipeline> - <map:match pattern="sql-page.xml.sql"> - <map:read src="sql-page.xml.sql" mime-type="text/plain"/> - </map:match> - - <map:match pattern="*"> - <map:generate src="{1}.xml"/> - <map:transform type="sql"> - <map:parameter name="use-connection" value="personnel"/> - <!-- - Let's have a look at the user docs: - - "[...] The purpose of the SQLTransformer is to query a - database and translate the result to XML. [...]" - --> - </map:transform> - <map:transform src="../stylesheets/sql2html.xsl"> - <map:parameter name="servletPath" value="{request:servletPath}"/> - <map:parameter name="sitemapURI" value="{request:sitemapURI}"/> - <map:parameter name="contextPath" value="{request:contextPath}"/> - <map:parameter name="file" value=".xml"/> - </map:transform> - <map:serialize/> - </map:match> - - <map:match pattern=""> - <map:redirect-to uri="../"/> - </map:match> - - </map:pipeline> - - </map:pipelines> + <map:pipeline> + <map:match pattern="*"> + <map:generate src="{1}.xml"/> + <!-- + - Let's have a look at the user docs: + - + - "[...] The purpose of the SQLTransformer is to query a + - database and translate the result to XML. [...]" + --> + <map:transform type="sql"> + <map:parameter name="use-connection" value="personnel"/> + </map:transform> + <map:transform src="../stylesheets/sql2html.xsl"> + <map:parameter name="servletPath" value="{request:servletPath}"/> + <map:parameter name="sitemapURI" value="{request:sitemapURI}"/> + <map:parameter name="contextPath" value="{request:contextPath}"/> + <map:parameter name="file" value=".xml"/> + </map:transform> + <map:serialize/> + </map:match> + + <map:match pattern=""> + <map:redirect-to uri="../"/> + </map:match> -</map:sitemap> + </map:pipeline> + </map:pipelines> -<!-- end of file --> +</map:sitemap> Modified: cocoon/blocks/unsupported/databases/trunk/samples/transform/sql-page.xml URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/databases/trunk/samples/transform/sql-page.xml?rev=167957&r1=167956&r2=167957&view=diff ============================================================================== --- cocoon/blocks/unsupported/databases/trunk/samples/transform/sql-page.xml (original) +++ cocoon/blocks/unsupported/databases/trunk/samples/transform/sql-page.xml Tue May 3 12:01:31 2005 @@ -15,27 +15,26 @@ limitations under the License. --> -<page xmlns:sql="http://apache.org/cocoon/SQL/2.0"> +<page> + <title>Hello</title> - <title>Hello</title> - <resources> - <resource type="file" href="sql-page.xml.sql">Schema</resource> - <resource type="doc" href="userdocs/transformers/sql-transformer.html">SQL Transformer</resource> - </resources> - <content> - <para>This is my first Cocoon2 page filled with sql data!</para> + <resources> + <resource type="file" href="../schema.sql">Schema</resource> + <resource type="doc" href="userdocs/transformers/sql-transformer.html">SQL Transformer</resource> + </resources> - <execute-query xmlns="http://apache.org/cocoon/SQL/2.0"> - <query> - select id,name from department - </query> - <execute-query> - <query> - select id,name from employee where department_id = <ancestor-value sql:name="id" sql:level="1"/> - </query> - </execute-query> - </execute-query> + <content> + <para>This is my first Cocoon2 page filled with SQL data!</para> - </content> + <sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0"> + <sql:query> + select id, name, description from department + </sql:query> + <sql:execute-query> + <sql:query> + select id, name from employee where department_id = <sql:ancestor-value sql:name="id" sql:level="1"/> + </sql:query> + </sql:execute-query> + </sql:execute-query> + </content> </page> - Modified: cocoon/blocks/unsupported/databases/trunk/samples/xsp/esql.xsp URL: http://svn.apache.org/viewcvs/cocoon/blocks/unsupported/databases/trunk/samples/xsp/esql.xsp?rev=167957&r1=167956&r2=167957&view=diff ============================================================================== --- cocoon/blocks/unsupported/databases/trunk/samples/xsp/esql.xsp (original) +++ cocoon/blocks/unsupported/databases/trunk/samples/xsp/esql.xsp Tue May 3 12:01:31 2005 @@ -15,151 +15,136 @@ limitations under the License. --> -<!-- CVS: $Id: esql.xsp,v 1.5 2004/04/05 12:25:35 antonio Exp $ --> +<!-- CVS: $Id$ --> <xsp:page language="java" xmlns:xsp="http://apache.org/xsp" xmlns:esql="http://apache.org/cocoon/SQL/v2"> <page> - <title>A Database Driven XSP Page</title> + <title>A Database Driven XSP Page</title> <resources> - <resource type="file" href="../transform/sql-page.xml.sql">Schema</resource> - <resource type="doc" href="userdocs/xsp/esql">ESQL</resource> + <resource type="file" href="../schema.sql">Schema</resource> + <resource type="doc" href="userdocs/xsp/esql">ESQL</resource> </resources> - <content> - - <esql:connection> - <esql:pool>personnel</esql:pool> - - - <para> - Below you see all guys from the departments - </para> - - <esql:execute-query> - <esql:query>select * from employee</esql:query> - <esql:results> - <esql:row-results> - <para><esql:get-string column="name"/></para> - <!-- uncomment if you want columns to become tags --> - <!-- <esql:get-columns/> --> - </esql:row-results> - </esql:results> - </esql:execute-query> - - <hr/> - - <para> - Below you see just some of the guys - </para> - - <esql:execute-query> - <esql:query>select * from employee</esql:query> - <esql:use-limit-clause>jdbc</esql:use-limit-clause> - <esql:skip-rows>1</esql:skip-rows> - <esql:max-rows>2</esql:max-rows> - <esql:results> - <esql:row-results> - <para><esql:get-string column="name"/></para> - </esql:row-results> - <esql:previous-results> - We skipped some. - </esql:previous-results> - <esql:more-results> - There are some more. - </esql:more-results> - <para> - There is a total of <esql:row-count/> employees. - </para> - </esql:results> - </esql:execute-query> - - <hr/> - - <para> - Below departments and employees are printed. - Without the grouping feature, the result would look like this: - </para> - - <esql:execute-query> - <esql:query> - SELECT department.name, 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> - <Department> - <xsp:attribute name='name'><esql:get-string column='name'/></xsp:attribute> - <h2><esql:get-string column='name'/></h2> - <para><employee><esql:get-string column='empName'/></employee></para> - </Department> - </esql:row-results> - </esql:results> - </esql:execute-query> - - <hr/> - - <para> - This uses the grouping feature in esql. - </para> - - <esql:execute-query> - <esql:query> - SELECT department.name, 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='name'><!-- grouping --> - <Department> - <xsp:attribute name='name'><esql:get-string column='name'/></xsp:attribute> - <h2><esql:get-string column='name'/></h2> - <esql:member><!-- grouping --> - <para><employee><esql:get-string column='empName'/></employee></para> - </esql:member><!--grouping --> - </Department> - </esql:group><!-- grouping --> - </esql:row-results> - </esql:results> - </esql:execute-query> - - <hr/> - - <para> - This uses nested queries. - </para> - - <esql:execute-query> - <esql:query> - SELECT name, id FROM department ORDER BY name - </esql:query> - <esql:results> - <esql:row-results> - <Department> - <xsp:attribute name='name'><esql:get-string column='name'/></xsp:attribute> - <h2><esql:get-string column='name'/></h2> - - <esql:execute-query> - <esql:query> - select name from employee - where department_id = <esql:parameter type="int"><esql:get-int column="id" ancestor="1"/></esql:parameter> - </esql:query> - <esql:results> - <esql:row-results> - <para><employee><esql:get-string column='name'/></employee></para> - </esql:row-results> - </esql:results> - </esql:execute-query> - - </Department> - </esql:row-results> - </esql:results> - </esql:execute-query> + <content> + <esql:connection> + <esql:pool>personnel</esql:pool> + + <h3>Below you see all of the guys</h3> + <ul> + <esql:execute-query> + <esql:query>select * from employee</esql:query> + <esql:results> + <esql:row-results> + <li><esql:get-string column="name"/></li> + <!-- uncomment if you want columns to become tags --> + <!-- <esql:get-columns/> --> + </esql:row-results> + </esql:results> + </esql:execute-query> + </ul> + + <h3>Below you see just some of the guys</h3> + <esql:execute-query> + <esql:query>select * from employee</esql:query> + <esql:use-limit-clause>jdbc</esql:use-limit-clause> + <esql:skip-rows>1</esql:skip-rows> + <esql:max-rows>2</esql:max-rows> + <esql:results> + <ul> + <esql:row-results> + <li><esql:get-string column="name"/></li> + </esql:row-results> + <esql:previous-results> + <li>We skipped some.</li> + </esql:previous-results> + <esql:more-results> + <li>There are some more.</li> + </esql:more-results> + </ul> + <para> + There is a total of <esql:row-count/> employees. + </para> + </esql:results> + </esql:execute-query> + + <h3> + Below departments and employees are printed. + Without the grouping feature, the result would look like this: + </h3> + + <esql:execute-query> + <esql:query> + SELECT department.name, 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> + <Department> + <xsp:attribute name='name'><esql:get-string column='name'/></xsp:attribute> + <h4><esql:get-string column='name'/></h4> + <para><employee><esql:get-string column='empName'/></employee></para> + </Department> + </esql:row-results> + </esql:results> + </esql:execute-query> + + <h3> + This uses the grouping feature in esql. + </h3> + + <esql:execute-query> + <esql:query> + SELECT department.name, 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='name'><!-- grouping --> + <Department> + <xsp:attribute name='name'><esql:get-string column='name'/></xsp:attribute> + <h4><esql:get-string column='name'/></h4> + <esql:member><!-- grouping --> + <para><employee><esql:get-string column='empName'/></employee></para> + </esql:member><!--grouping --> + </Department> + </esql:group><!-- grouping --> + </esql:row-results> + </esql:results> + </esql:execute-query> + + <h3>This uses nested queries.</h3> + <esql:execute-query> + <esql:query> + SELECT name, id FROM department ORDER BY name + </esql:query> + <esql:results> + <esql:row-results> + <Department> + <xsp:attribute name='name'><esql:get-string column='name'/></xsp:attribute> + <h4><esql:get-string column='name'/></h4> + + <esql:execute-query> + <esql:query> + select name from employee + where department_id = <esql:parameter type="int"><esql:get-int column="id" ancestor="1"/></esql:parameter> + </esql:query> + <esql:results> + <esql:row-results> + <para><employee><esql:get-string column='name'/></employee></para> + </esql:row-results> + </esql:results> + </esql:execute-query> + + </Department> + </esql:row-results> + </esql:results> + </esql:execute-query> </esql:connection> - </content> + </content> </page> </xsp:page>