cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r168589 - in /cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples: org-db/add-department.xsp org-db/departments.xsp org-db/process-department.xsp samples.xml transform/sql-page3.xml
Date Fri, 06 May 2005 10:19:23 GMT
Author: cziegeler
Date: Fri May  6 03:19:21 2005
New Revision: 168589

URL: http://svn.apache.org/viewcvs?rev=168589&view=rev
Log:
Add some more samples

Added:
    cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/org-db/departments.xsp   (with
props)
    cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/transform/sql-page3.xml   (with
props)
Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/org-db/add-department.xsp
    cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/org-db/process-department.xsp
    cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/samples.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/org-db/add-department.xsp
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/org-db/add-department.xsp?rev=168589&r1=168588&r2=168589&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/org-db/add-department.xsp (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/org-db/add-department.xsp Fri
May  6 03:19:21 2005
@@ -31,6 +31,7 @@
       <form action="process-department" method="POST">
         <input name="process" type="hidden" value="Add"/>
         <para>Department Name: <input name="name" type="text"/></para>
+        <para>Description: <textarea name="desc" cols="50" rows="10"></textarea></para>
         <input type="submit" value="Add"/>
       </form>
     </content>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/org-db/departments.xsp
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/org-db/departments.xsp?rev=168589&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/org-db/departments.xsp (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/org-db/departments.xsp Fri May
 6 03:19:21 2005
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2005 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<xsp:page language="java"
+          xmlns:xsp="http://apache.org/xsp"
+          xmlns:esql="http://apache.org/cocoon/SQL/v2">
+  <page>
+    <title>Show Departments</title>
+    <content>
+      <esql:connection>
+        <esql:pool>personnel</esql:pool>
+        <esql:execute-query>
+          <esql:query>select id, name, description from department order by name</esql:query>
+          <esql:results>
+            <esql:row-results>
+              <li><esql:get-string column="id"/>. <esql:get-string column="name"/>
: <esql:get-string column="description"/></li>
+            </esql:row-results>
+          </esql:results>
+        </esql:execute-query>
+      </esql:connection>
+    </content>
+  </page>
+</xsp:page>

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/org-db/departments.xsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/org-db/departments.xsp
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/org-db/process-department.xsp
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/org-db/process-department.xsp?rev=168589&r1=168588&r2=168589&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/org-db/process-department.xsp
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/org-db/process-department.xsp
Fri May  6 03:19:21 2005
@@ -23,6 +23,7 @@
   <xsp:logic>
     String process = null;
     String name = null;
+    String desc = null;
     int currId = -1;
   </xsp:logic>
 
@@ -30,6 +31,7 @@
     <xsp:logic>
       process = <xsp-request:get-parameter name="process"/>;
       name = <xsp-request:get-parameter name="name"/>;
+      desc = <xsp-request:get-parameter name="desc"/>;
     </xsp:logic>
 
     <resources>
@@ -54,9 +56,10 @@
               </xsp:logic>
               <esql:execute-query>
                 <esql:query>
-                  insert into department (id, name) values (
+                  insert into department (id, name, description) values (
                     (<esql:parameter><xsp:expr>currId</xsp:expr></esql:parameter>
+ 1),
-                    <esql:parameter><xsp:expr>name</xsp:expr></esql:parameter>
+                    <esql:parameter><xsp:expr>name</xsp:expr></esql:parameter>,
+                    <esql:parameter><xsp:expr>desc</xsp:expr></esql:parameter>
                   )
                 </esql:query>
               </esql:execute-query>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/samples.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/samples.xml?rev=168589&r1=168588&r2=168589&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/samples.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/samples.xml Fri May  6 03:19:21
2005
@@ -40,6 +40,9 @@
      <sample name="Nested Queries" href="transform/sql-page2" xlink:role="dynamic">
        Example with two queries nested into the third one.
      </sample>
+     <sample name="XML Test" href="transform/sql-page3" xlink:role="dynamic">
+       Example with inserting XML into a database.
+     </sample>
   </group>
 
   <group name="XSP">
@@ -86,6 +89,9 @@
      </sample>
      <sample name="Insert Employees" href="org-db/add-employee" xlink:role="dynamic">
        Adds new Employees to the employees table.
+     </sample>
+     <sample name="Show Departments" href="org-db/departments" xlink:role="dynamic">
+       Show all departments.
      </sample>
   </group>
 

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/transform/sql-page3.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/transform/sql-page3.xml?rev=168589&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/transform/sql-page3.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/transform/sql-page3.xml Fri
May  6 03:19:21 2005
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<page>
+  <title>Hello</title>
+
+  <resources>
+    <resource type="file" href="../schema.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>
+
+    <sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0">
+      <sql:query>
+        select max(id) as maxid from department
+      </sql:query>
+      <sql:execute-query>
+        <sql:query>
+         insert into department (id, name, description) 
+             values(<sql:ancestor-value name="maxid" level="1"/> + 1, 'XML Test',
+            '<span>An XML Test</span>')
+        </sql:query>
+      </sql:execute-query>
+    </sql:execute-query>
+  </content>
+</page>

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/transform/sql-page3.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/transform/sql-page3.xml
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message