Return-Path:
Delivered-To: apmail-cocoon-cvs-archive@www.apache.org
Received: (qmail 22314 invoked from network); 6 May 2005 14:56:57 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199)
by minotaur.apache.org with SMTP; 6 May 2005 14:56:57 -0000
Received: (qmail 18755 invoked by uid 500); 6 May 2005 14:54:50 -0000
Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org
Received: (qmail 18587 invoked by uid 500); 6 May 2005 14:54:47 -0000
Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm
Precedence: bulk
Reply-To: dev@cocoon.apache.org
list-help:
list-unsubscribe:
List-Post:
Delivered-To: mailing list cvs@cocoon.apache.org
Received: (qmail 18531 invoked by uid 99); 6 May 2005 14:54:45 -0000
X-ASF-Spam-Status: No, hits=0.2 required=10.0
tests=NO_REAL_NAME
X-Spam-Check-By: apache.org
Received: from minotaur.apache.org (HELO minotaur.apache.org)
(209.237.227.194)
by apache.org (qpsmtpd/0.28) with SMTP; Fri, 06 May 2005 07:54:42 -0700
Received: (qmail 20061 invoked by uid 65534); 6 May 2005 14:51:58 -0000
Message-ID: <20050506145158.20059.qmail@minotaur.apache.org>
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Subject: svn commit: r168611 - in /cocoon/branches/BRANCH_2_1_X: ./
src/blocks/databases/java/org/apache/cocoon/transformation/
src/blocks/databases/samples/ src/blocks/databases/samples/stylesheets/
src/blocks/databases/samples/transform/
Date: Fri, 06 May 2005 14:51:57 -0000
To: cvs@cocoon.apache.org
From: vgritsenko@apache.org
X-Mailer: svnmailer-1.0.0-dev
X-Virus-Checked: Checked
X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N
Author: vgritsenko
Date: Fri May 6 07:51:55 2005
New Revision: 168611
URL: http://svn.apache.org/viewcvs?rev=3D168611&view=3Drev
Log:
fix bug #25098
Modified:
cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoo=
n/transformation/SQLTransformer.java
cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/samples.xml
cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/stylesheets/s=
ql2html.xsl
cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/transform/sit=
emap.xmap
cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/transform/sql=
-page2.xml
cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/transform/sql=
-page3.xml
cocoon/branches/BRANCH_2_1_X/status.xml
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache=
/cocoon/transformation/SQLTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/=
databases/java/org/apache/cocoon/transformation/SQLTransformer.java?rev=3D1=
68611&r1=3D168610&r2=3D168611&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoo=
n/transformation/SQLTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoo=
n/transformation/SQLTransformer.java Fri May 6 07:51:55 2005
@@ -132,6 +132,12 @@
* own-connection
parameter.
*
*
+ *
+ * TODO: Support inserting of the XML data into the database without need =
to escape it.
+ * Can be implemented by introducing new <sql:xml/> tag to ind=
icate that
+ * startSerializedXMLRecording(...) should be used.
+ *
+ *
* @author Carsten Ziegeler
* @author Donald Ball
* @author Giacomo Pati
@@ -1158,7 +1164,7 @@
=20
if (success) {
AttributesImpl attr =3D new AttributesImpl();
- if (this.showNrOfRows) {
+ if (showNrOfRows) {
attr.addAttribute("", this.nrOfRowsAttr, this.nrOf=
RowsAttr, "CDATA", String.valueOf(getNrOfRows()));
}
String name =3D getName();
@@ -1167,7 +1173,9 @@
}
start(this.rowsetElement, attr);
=20
- if (!isStoredProcedure) {
+ if (isStoredProcedure) {
+ serializeStoredProcedure();
+ } else {
while (next()) {
start(this.rowElement, EMPTY_ATTRIBUTES);
serializeRow();
@@ -1176,8 +1184,6 @@
}
end(this.rowElement);
}
- } else {
- serializeStoredProcedure();
}
=20
end(this.rowsetElement);
@@ -1262,6 +1268,7 @@
=20
protected int getNrOfRows() throws SQLException {
int nr =3D 0;
+
if (rs !=3D null) {
if (oldDriver) {
nr =3D -1;
@@ -1324,10 +1331,12 @@
// If rv is not -1, then an SQL insert, update, etc, has
// happened (see JDBC docs - return codes for executeUpdate)
if (rv !=3D -1) {
- return false;
+ // Output row with return code. Once.
+ return true;
}
=20
if (rs =3D=3D null || !rs.next()) {
+ // No more rows.
return false;
}
=20
@@ -1400,18 +1409,20 @@
=20
protected void serializeRow()
throws SQLException, SAXException {
- if (!isUpdate && !isStoredProcedure) {
+ if (rv !=3D -1) {
+ start("returncode", EMPTY_ATTRIBUTES);
+ serializeData(String.valueOf(rv));
+ end("returncode");
+ // We only want the return code shown once.
+ // Reset rv so next() returns false next time.
+ rv =3D -1;
+ } else {
for (int i =3D 1; i <=3D md.getColumnCount(); i++) {
String columnName =3D getColumnName(md.getColumnName(i=
));
start(columnName, EMPTY_ATTRIBUTES);
serializeData(getColumnValue(i));
end(columnName);
}
- } else if (isUpdate && !isStoredProcedure) {
- start("returncode", EMPTY_ATTRIBUTES);
- serializeData(String.valueOf(rv));
- end("returncode");
- rv =3D -1; // we only want the return code shown once.
}
}
=20
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=3D168611&r1=3D168610&r2=3D168611&view=3Dd=
iff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- 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 F=
ri May 6 07:51:55 2005
@@ -41,7 +41,8 @@
Example with two queries nested into the third one.
- Example with inserting XML into a database.
+ Example with inserting XML into a database and with a select statem=
ent
+ nested into the insert statement.
=20
@@ -68,7 +69,7 @@
modular package which supports auto increments and more.
- A simple example demonstrating of populating a binary database colu=
mn=20
+ A simple example demonstrating of populating a binary database colu=
mn
via a multipart form file upload.
@@ -107,5 +108,5 @@
Start the tutorial application.
- =20
+
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/stylesh=
eets/sql2html.xsl
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/=
databases/samples/stylesheets/sql2html.xsl?rev=3D168611&r1=3D168610&r2=3D16=
8611&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/stylesheets/s=
ql2html.xsl (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/stylesheets/s=
ql2html.xsl Fri May 6 07:51:55 2005
@@ -60,6 +60,13 @@
=20
=20
+
+
+
+ rows updated.
+ |
+
+
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/transfo=
rm/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/=
databases/samples/transform/sitemap.xmap?rev=3D168611&r1=3D168610&r2=3D1686=
11&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/transform/sit=
emap.xmap (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/databases/samples/transform/sit=
emap.xmap Fri May 6 07:51:55 2005
@@ -36,8 +36,8 @@
=20
-
+
- insert into department (id, name, description)=20
- values( + 1, =
'XML Test',
- 'An XML Test')
+ insert into department (id, name, description)
+ values(,
+ 'XML Test ',
+ '<span>A th attempt to insert <i>XML</i> into the database.</=
span>')
+
+
+
+
+ select id, name, description from department
+
+
+
Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?=
rev=3D168611&r1=3D168610&r2=3D168611&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Fri May 6 07:51:55 2005
@@ -196,6 +196,11 @@
=20
+
+ Databases: SQLTransformer: Support queries nested into insert/delete=
/update
+ queries. Return number of rows updated by insert/delete/update queri=
es as
+ returncode
element.
+
Databases: SQLTransformer: Each query can now have connection with o=
wn
database connection configuration parameters. Queries with same conf=
iguration