org.apache.cocoon.components.modules.database
Interface AutoIncrementModule

All Superinterfaces:
Component
All Known Implementing Classes:
AbstractAutoIncrementModule, HsqlIdentityAutoIncrementModule, IfxSerialAutoIncrementModule, ManualAutoIncrementModule, McKoiSequenceModule, MysqlAutoIncrementModule, PgsqlAutoIncrementModule, SQLServerIdentityAutoIncrementModule

public interface AutoIncrementModule
extends Component

Abstraction layer to encapsulate different DBMS behaviour for key attribute columns.

Version:
CVS $Id: AutoIncrementModule.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Christian Haul

Field Summary
static String ROLE
           
 
Method Summary
 Object getPostValue(Configuration tableConf, Configuration columnConf, Configuration modeConf, Connection conn, Statement stmt, Map objectModel)
          Return key attribute value of last inserted row.
 Object getPreValue(Configuration tableConf, Configuration columnConf, Configuration modeConf, Connection conn, Map objectModel)
          Provide the value for the key attribute column.
 String getSubquery(Configuration tableConf, Configuration columnConf, Configuration modeConf)
          Provide subquery string for the key attribute column.
 boolean includeAsValue()
          Boolean whether the key attribute needs to be included in the insert query as an attribute value (no subquery).
 boolean includeInQuery()
          Boolean whether the key attribute column needs to be included in the insert query.
 

Field Detail

ROLE

static final String ROLE
Method Detail

getPostValue

Object getPostValue(Configuration tableConf,
                    Configuration columnConf,
                    Configuration modeConf,
                    Connection conn,
                    Statement stmt,
                    Map objectModel)
                    throws SQLException,
                           ConfigurationException
Return key attribute value of last inserted row.

Parameters:
tableConf - Table's configuration from resource description.
columnConf - column's configuration from resource description.
modeConf - this mode's configuration from resource description.
conn - Connection
stmt - Statement that was executed to insert the last row.
objectModel - The objectModel
Returns:
value representing the last key value value.
Throws:
SQLException
ConfigurationException

includeInQuery

boolean includeInQuery()
Boolean whether the key attribute column needs to be included in the insert query.

Returns:
true if the column is needed, false if the column should be skipped.

includeAsValue

boolean includeAsValue()
Boolean whether the key attribute needs to be included in the insert query as an attribute value (no subquery).

Returns:
true if a value is needed, false if a subquery expression is used or the column is skipped altogether.

getPreValue

Object getPreValue(Configuration tableConf,
                   Configuration columnConf,
                   Configuration modeConf,
                   Connection conn,
                   Map objectModel)
                   throws SQLException,
                          ConfigurationException
Provide the value for the key attribute column. If a value for the key value column is needed (i.e. the column is not skipped), this value is computed here.

Parameters:
tableConf - Table's configuration from resource description.
columnConf - column's configuration from resource description.
modeConf - this mode's configuration from resource description.
conn - Connection
objectModel - The objectModel
Returns:
exact value for key attribute column
Throws:
SQLException
ConfigurationException

getSubquery

String getSubquery(Configuration tableConf,
                   Configuration columnConf,
                   Configuration modeConf)
                   throws ConfigurationException
Provide subquery string for the key attribute column. If a value for the autoincrement column is needed (i.e. the column is not skipped), and the value can be determined through a nested subquery, this function provides the subquery as a string.

Returns:
subquery string for autoincrement column.
Throws:
ConfigurationException


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.