You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by bl...@apache.org on 2001/03/12 23:12:35 UTC
cvs commit: xml-cocoon/src/org/apache/cocoon/acting DatabaseAddAction.java OraAddAction.java
bloritsch 01/03/12 14:12:35
Modified: src/org/apache/cocoon/acting Tag: xml-cocoon2
DatabaseAddAction.java OraAddAction.java
Log:
More index fixes and support for a new "key" mode.
Revision Changes Path
No revision
No revision
1.1.2.17 +9 -3 xml-cocoon/src/org/apache/cocoon/acting/Attic/DatabaseAddAction.java
Index: DatabaseAddAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/DatabaseAddAction.java,v
retrieving revision 1.1.2.16
retrieving revision 1.1.2.17
diff -u -r1.1.2.16 -r1.1.2.17
--- DatabaseAddAction.java 2001/03/12 18:16:58 1.1.2.16
+++ DatabaseAddAction.java 2001/03/12 22:12:32 1.1.2.17
@@ -40,7 +40,7 @@
* only one table at a time to update.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.16 $ $Date: 2001/03/12 18:16:58 $
+ * @version CVS $Revision: 1.1.2.17 $ $Date: 2001/03/12 22:12:32 $
*/
public class DatabaseAddAction extends AbstractDatabaseAction {
protected static final Map addStatements = new HashMap();
@@ -75,7 +75,9 @@
currentIndex = 1;
for (int i = 0; i < keys.length; i++) {
- if ("manual".equals(keys[i].getAttribute("mode", "automatic"))) {
+ String mode = keys[i].getAttribute("mode", "automatic");
+
+ if ("manual".equals(mode)) {
String selectQuery = this.getSelectQuery(keys[i]);
ResultSet set = conn.createStatement().executeQuery(selectQuery);
@@ -87,6 +89,9 @@
set.close();
set.getStatement().close();
currentIndex++;
+ } else if ("form".equals(mode)) {
+ this.setColumn(statement, currentIndex, request, values[i]);
+ currentIndex++;
}
}
@@ -145,7 +150,8 @@
int numKeys = 0;
for (int i = 0; i < keys.length; i++) {
- if ("manual".equals(keys[i].getAttribute("mode", "automatic"))) {
+ String mode = keys[i].getAttribute("mode", "automatic");
+ if ("manual".equals(mode) || "form".equals(mode)) {
if (i > 0) {
queryBuffer.append(", ");
}
1.1.2.7 +24 -9 xml-cocoon/src/org/apache/cocoon/acting/Attic/OraAddAction.java
Index: OraAddAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/OraAddAction.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- OraAddAction.java 2001/03/12 20:52:05 1.1.2.6
+++ OraAddAction.java 2001/03/12 22:12:33 1.1.2.7
@@ -41,7 +41,7 @@
* only one table at a time to update.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/03/12 20:52:05 $
+ * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/03/12 22:12:33 $
*/
public class OraAddAction extends DatabaseAddAction {
private static final Map selectLOBStatements = new HashMap();
@@ -69,13 +69,16 @@
}
PreparedStatement statement = conn.prepareStatement(query);
+ getLogger().info(query);
Configuration[] keys = conf.getChild("table").getChild("keys").getChildren("key");
Configuration[] values = conf.getChild("table").getChild("values").getChildren("value");
currentIndex = 1;
for (int i = 0; i < keys.length; i++) {
- if ("manual".equals(keys[i].getAttribute("mode", "automatic"))) {
+ String mode = keys[i].getAttribute("mode", "automatic");
+
+ if ("manual".equals(mode)) {
String selectQuery = this.getSelectQuery(keys[i]);
ResultSet set = conn.createStatement().executeQuery(selectQuery);
@@ -85,11 +88,15 @@
statement.setInt(currentIndex, value);
request.setAttribute(keys[i].getAttribute("param"), String.valueOf(value));
- getLogger().info(currentIndex + ": " + keys[i].getAttribute("param"));
set.close();
set.getStatement().close();
currentIndex++;
+ } else if ("form".equals(mode)) {
+ String parameter = keys[i].getAttribute("param");
+ request.setAttribute(parameter, request.getParameter(parameter));
+ this.setColumn(statement, currentIndex, request, keys[i]);
+ currentIndex++;
}
}
@@ -122,15 +129,19 @@
statement.close();
query = this.getSelectLOBQuery(conf);
+ getLogger().info(query);
if ("".equals(query) == false) {
PreparedStatement LOBstatement = conn.prepareStatement(query);
getLogger().info(query);
- currentIndex = 1;
+ if (keys.length > 0) {
+ currentIndex = 1;
- for (int i = 0; i < keys.length; i++, currentIndex++) {
- this.setColumn(statement, currentIndex, request, keys[i]);
+ for (int i = 0; i < keys.length; i++) {
+ this.setColumn(statement, currentIndex, request, keys[i]);
+ currentIndex++;
+ }
}
OracleResultSet set = (OracleResultSet) LOBstatement.executeQuery();
@@ -236,13 +247,17 @@
int numKeys = 0;
for (int i = 0; i < keys.length; i++) {
- if ("manual".equals(keys[i].getAttribute("mode", "automatic"))) {
- if (i > 0) {
+ String mode = keys[i].getAttribute("mode", "automatic");
+ if ("manual".equals(mode) || "form".equals(mode)) {
+ if (numKeys > 0) {
queryBuffer.append(", ");
}
queryBuffer.append(keys[i].getAttribute("dbcol"));
- this.setSelectQuery(table.getAttribute("name"), keys[i]);
+
+ if ("manual".equals(mode)) {
+ this.setSelectQuery(table.getAttribute("name"), keys[i]);
+ }
numKeys++;
}
}
----------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org