Save This Page
Home » cocoon-2.1.11-src » org.apache » cocoon » acting » modular » [javadoc | source]
org.apache.cocoon.acting.modular
public class: DatabaseQueryAction [javadoc | source]
java.lang.Object
   org.apache.avalon.framework.logger.AbstractLogEnabled
      org.apache.cocoon.acting.AbstractAction
         org.apache.cocoon.acting.AbstractConfigurableAction
            org.apache.cocoon.acting.ConfigurableServiceableAction
               org.apache.cocoon.acting.AbstractComplementaryConfigurableAction
                  org.apache.cocoon.acting.modular.DatabaseAction
                     org.apache.cocoon.acting.modular.DatabaseQueryAction

All Implemented Interfaces:
    org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.thread.ThreadSafe, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.configuration.Configurable, Action

Executes an arbitrary query. The query is associated with a table and selected through the others mode. All keys and values are set in order of appearance, starting with keys, thus the query needs to have as many placeholders for prepared statement parameters. If it is an update query, the number of affected rows is returned to the sitemap.
<table name="example">
<queries>
<query mode="one">update example set count=count+1 where id=?</query>
<query mode="two">select count, name from example where id=?</query>
</queries>
<keys>
<key name="id"/>
</keys>
<values/>
</table>
Fields inherited from org.apache.cocoon.acting.modular.DatabaseAction:
MODE_AUTOINCR,  MODE_OTHERS,  MODE_OUTPUT,  ATTRIBUTE_KEY,  inputHint,  outputHint,  databaseHint,  INPUT_MODULE_SELECTOR,  OUTPUT_MODULE_SELECTOR,  DATABASE_MODULE_SELECTOR,  dbselector,  defaultModeNames,  cachedQueryData,  pathSeparator,  firstRow,  failOnEmpty
Fields inherited from org.apache.cocoon.acting.ConfigurableServiceableAction:
manager
Fields inherited from org.apache.cocoon.acting.AbstractConfigurableAction:
settings
Fields inherited from org.apache.cocoon.acting.AbstractAction:
EMPTY_MAP
Method from org.apache.cocoon.acting.modular.DatabaseQueryAction Summary:
getColumnValues,   getQuery,   honourAutoIncrement,   processRow,   selectMode
Methods from org.apache.cocoon.acting.modular.DatabaseAction:
act,   configure,   dispose,   fillModes,   getColumnValue,   getColumnValues,   getDataSource,   getMode,   getOutputName,   getOutputName,   getQuery,   honourAutoIncrement,   isLargeObject,   processRow,   processTable,   selectMode,   service,   setColumn,   setColumn,   setOutput,   setOutputAttribute
Methods from org.apache.cocoon.acting.AbstractComplementaryConfigurableAction:
getConfiguration,   getConfiguration,   getConfiguration
Methods from org.apache.cocoon.acting.ConfigurableServiceableAction:
service
Methods from org.apache.cocoon.acting.AbstractConfigurableAction:
configure
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.cocoon.acting.modular.DatabaseQueryAction Detail:
 protected Object[][] getColumnValues(Configuration tableConf,
    CacheHelper queryData,
    Map objectModel) throws ConfigurationException, ServiceException 
    Fetch all values for all columns that are needed to do the database operation.
 protected CacheHelper getQuery(Configuration table,
    Map modeTypes,
    Map defaultModeNames) throws ConfigurationException, ServiceException 
    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.
 protected boolean honourAutoIncrement() 
    determine whether autoincrement columns should be honoured by this operation. This is usually snsible only for INSERTs.
 protected int processRow(Map objectModel,
    Connection conn,
    PreparedStatement statement,
    String outputMode,
    Configuration table,
    CacheHelper queryData,
    Object[][] columnValues,
    int rowIndex,
    Map results) throws Exception, SQLException, ConfigurationException 
    set all necessary ?s and execute the query
 protected String selectMode(boolean isAutoIncrement,
    Map modes) 
    determine which mode to use as default mode here: SELECT highly specific to operation INSERT / UPDATE / DELETE / SELECT