org.apache.cocoon.acting.modular
Class DatabaseAddAction
java.lang.Object
|
+--org.apache.avalon.framework.logger.AbstractLoggable
|
+--org.apache.cocoon.acting.AbstractAction
|
+--org.apache.cocoon.acting.AbstractConfigurableAction
|
+--org.apache.cocoon.acting.ConfigurableComposerAction
|
+--org.apache.cocoon.acting.AbstractComplementaryConfigurableAction
|
+--org.apache.cocoon.acting.modular.DatabaseAction
|
+--org.apache.cocoon.acting.modular.DatabaseAddAction
- All Implemented Interfaces:
- Action, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.logger.Loggable
- public class DatabaseAddAction
- extends DatabaseAction
Adds record in a database. The action can update one or more
tables, and can add more than one row to a table at a time. See
DatabaseAction
for details.
- Version:
- CVS $Id: DatabaseAddAction.java,v 1.5 2002/08/25 08:54:29 haul Exp $
- Author:
- Christian Haul
Fields inherited from interface org.apache.cocoon.acting.Action |
ROLE |
Method Summary |
protected java.lang.Object[][] |
getColumnValues(org.apache.avalon.framework.configuration.Configuration tableConf,
DatabaseAction.CacheHelper queryData,
java.util.Map objectModel)
Fetch all values for all columns that are needed to do the
database operation. |
protected DatabaseAction.CacheHelper |
getQuery(org.apache.avalon.framework.configuration.Configuration table,
java.util.Map modeTypes,
java.util.Map defaultModeNames)
Get the String representation of the PreparedStatement. |
protected boolean |
honourAutoIncrement()
determine whether autoincrement columns should be honoured by
this operation. |
protected int |
processRow(java.util.Map objectModel,
java.sql.Connection conn,
java.sql.PreparedStatement statement,
java.lang.String outputMode,
org.apache.avalon.framework.configuration.Configuration table,
DatabaseAction.CacheHelper queryData,
java.lang.Object[][] columnValues,
int rowIndex,
java.util.Map results)
set all necessary ? |
protected java.lang.String |
selectMode(boolean isAutoIncrement,
java.util.Map modes)
determine which mode to use as default mode
here: INSERT
highly specific to operation INSERT / UPDATE / DELETE / SELECT |
protected int |
setKeyAuto(org.apache.avalon.framework.configuration.Configuration table,
DatabaseAction.Column column,
int currentIndex,
int rowIndex,
java.sql.Connection conn,
java.sql.PreparedStatement statement,
java.util.Map objectModel,
java.lang.String outputMode,
java.util.Map results)
Sets the key value on the prepared statement for an autoincrement type. |
protected void |
storeKeyValue(org.apache.avalon.framework.configuration.Configuration tableConf,
DatabaseAction.Column key,
int rowIndex,
java.sql.Connection conn,
java.sql.Statement statement,
java.util.Map objectModel,
java.lang.String outputMode,
java.util.Map results)
Put key values into request attributes. |
Methods inherited from class org.apache.cocoon.acting.modular.DatabaseAction |
act, compose, configure, dispose, fillModes, getColumnValue, getDataSource, getMode, getOutputName, getOutputName, isLargeObject, processTable, setColumn, setColumn, setOutput, setOutputAttribute |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable |
getLogger, setLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DatabaseAddAction
public DatabaseAddAction()
processRow
protected int processRow(java.util.Map objectModel,
java.sql.Connection conn,
java.sql.PreparedStatement statement,
java.lang.String outputMode,
org.apache.avalon.framework.configuration.Configuration table,
DatabaseAction.CacheHelper queryData,
java.lang.Object[][] columnValues,
int rowIndex,
java.util.Map results)
throws java.sql.SQLException,
org.apache.avalon.framework.configuration.ConfigurationException,
java.lang.Exception
- set all necessary ?s and execute the query
- Overrides:
processRow
in class DatabaseAction
setKeyAuto
protected int setKeyAuto(org.apache.avalon.framework.configuration.Configuration table,
DatabaseAction.Column column,
int currentIndex,
int rowIndex,
java.sql.Connection conn,
java.sql.PreparedStatement statement,
java.util.Map objectModel,
java.lang.String outputMode,
java.util.Map results)
throws org.apache.avalon.framework.configuration.ConfigurationException,
java.sql.SQLException,
org.apache.avalon.framework.component.ComponentException,
java.lang.Exception
- Sets the key value on the prepared statement for an autoincrement type.
- Parameters:
table
- the table's configuration objectcolumn
- the key's configuration objectcurrentIndex
- the position of the key columnrowIndex
- the position in the current row setconn
- the database connectionstatement
- the insert statementobjectModel
- the objectModel objectoutputMode
- name of the requested output moduleresult
- sitemap result object- Returns:
- the number of columns by which to increment the currentIndex
storeKeyValue
protected void storeKeyValue(org.apache.avalon.framework.configuration.Configuration tableConf,
DatabaseAction.Column key,
int rowIndex,
java.sql.Connection conn,
java.sql.Statement statement,
java.util.Map objectModel,
java.lang.String outputMode,
java.util.Map results)
throws java.sql.SQLException,
org.apache.avalon.framework.configuration.ConfigurationException,
org.apache.avalon.framework.component.ComponentException
- Put key values into request attributes. Checks whether the
value needs to be retrieved from the database module first.
selectMode
protected java.lang.String selectMode(boolean isAutoIncrement,
java.util.Map modes)
- determine which mode to use as default mode
here: INSERT
highly specific to operation INSERT / UPDATE / DELETE / SELECT
- Overrides:
selectMode
in class DatabaseAction
honourAutoIncrement
protected boolean honourAutoIncrement()
- determine whether autoincrement columns should be honoured by
this operation. This is usually snsible only for INSERTs.
- Overrides:
honourAutoIncrement
in class DatabaseAction
getColumnValues
protected java.lang.Object[][] getColumnValues(org.apache.avalon.framework.configuration.Configuration tableConf,
DatabaseAction.CacheHelper queryData,
java.util.Map objectModel)
throws org.apache.avalon.framework.configuration.ConfigurationException,
org.apache.avalon.framework.component.ComponentException
- Fetch all values for all columns that are needed to do the
database operation.
getQuery
protected DatabaseAction.CacheHelper getQuery(org.apache.avalon.framework.configuration.Configuration table,
java.util.Map modeTypes,
java.util.Map defaultModeNames)
throws org.apache.avalon.framework.configuration.ConfigurationException,
org.apache.avalon.framework.component.ComponentException
- Get the String representation of the PreparedStatement. This is
mapped to the Configuration object itself, so if it doesn't exist,
it will be created.
- Overrides:
getQuery
in class DatabaseAction
- Parameters:
table
- the table's configuration object- Returns:
- the insert query as a string
Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.