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

All Superinterfaces:
org.apache.avalon.framework.component.Component
All Known Implementing Classes:
AbstractAutoIncrementModule, HsqlIdentityAutoIncrementModule, MysqlAutoIncrementModule, PgsqlAutoIncrementModule

public interface AutoIncrementModule
extends org.apache.avalon.framework.component.Component

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

Version:
CVS $Id: AutoIncrementModule.java,v 1.2 2002/05/28 13:41:28 haul Exp $
Author:
Christian Haul

Field Summary
static java.lang.String ROLE
           
 
Method Summary
 java.lang.Object getPostValue(org.apache.avalon.framework.configuration.Configuration tableConf, org.apache.avalon.framework.configuration.Configuration columnConf, org.apache.avalon.framework.configuration.Configuration modeConf, java.sql.Connection conn, java.sql.Statement stmt, java.util.Map objectModel)
          Return key attribute value of last inserted row.
 java.lang.Object getPreValue(org.apache.avalon.framework.configuration.Configuration tableConf, org.apache.avalon.framework.configuration.Configuration columnConf, org.apache.avalon.framework.configuration.Configuration modeConf, java.sql.Connection conn, java.util.Map objectModel)
          Provide the value for the key attribute column.
 java.lang.String getSubquery(org.apache.avalon.framework.configuration.Configuration tableConf, org.apache.avalon.framework.configuration.Configuration columnConf, org.apache.avalon.framework.configuration.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

public static final java.lang.String ROLE
See Also:
Constant Field Values
Method Detail

getPostValue

public java.lang.Object getPostValue(org.apache.avalon.framework.configuration.Configuration tableConf,
                                     org.apache.avalon.framework.configuration.Configuration columnConf,
                                     org.apache.avalon.framework.configuration.Configuration modeConf,
                                     java.sql.Connection conn,
                                     java.sql.Statement stmt,
                                     java.util.Map objectModel)
                              throws java.sql.SQLException,
                                     org.apache.avalon.framework.configuration.ConfigurationException
Return key attribute value of last inserted row.

Parameters:
tableConf - Table's configuration from resource description.
columnConf - column's configuration from resource description.
conn - Connection
stmt - Statement that was executed to insert the last row.
Returns:
value representing the last key value value.
java.sql.SQLException
org.apache.avalon.framework.configuration.ConfigurationException

includeInQuery

public 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

public 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

public java.lang.Object getPreValue(org.apache.avalon.framework.configuration.Configuration tableConf,
                                    org.apache.avalon.framework.configuration.Configuration columnConf,
                                    org.apache.avalon.framework.configuration.Configuration modeConf,
                                    java.sql.Connection conn,
                                    java.util.Map objectModel)
                             throws java.sql.SQLException,
                                    org.apache.avalon.framework.configuration.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.
conn - Connection
Returns:
exact value for key attribute column
java.sql.SQLException
org.apache.avalon.framework.configuration.ConfigurationException

getSubquery

public java.lang.String getSubquery(org.apache.avalon.framework.configuration.Configuration tableConf,
                                    org.apache.avalon.framework.configuration.Configuration columnConf,
                                    org.apache.avalon.framework.configuration.Configuration modeConf)
                             throws org.apache.avalon.framework.configuration.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.
org.apache.avalon.framework.configuration.ConfigurationException


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.