|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.avalon.framework.logger.AbstractLogEnabled | +--org.apache.cocoon.components.modules.database.AbstractAutoIncrementModule | +--org.apache.cocoon.components.modules.database.ManualAutoIncrementModule
Abstraction layer to encapsulate different DBMS behaviour for autoincrement columns. Here: manual mode The new value is determined by doing a "select max(column)+1 from table" query. With transactions and correct isolation levels, this should to the trick almost everywhere. Note however, that the above query does not prevent a parallel transaction to try to insert a row with the same ID since it requires only shared locks. C.f. "Phantom Problem"
Field Summary |
Fields inherited from class org.apache.cocoon.components.modules.database.AbstractAutoIncrementModule |
settings |
Fields inherited from interface org.apache.cocoon.components.modules.database.AutoIncrementModule |
ROLE |
Constructor Summary | |
ManualAutoIncrementModule()
|
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 modenConf,
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. |
protected java.lang.String |
getSelectQuery(java.lang.String tableName,
org.apache.avalon.framework.configuration.Configuration entry)
|
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. |
protected void |
setSelectQuery(java.lang.String tableName,
org.apache.avalon.framework.configuration.Configuration entry)
Set the String representation of the MaxID lookup statement. |
Methods inherited from class org.apache.cocoon.components.modules.database.AbstractAutoIncrementModule |
configure, dispose |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ManualAutoIncrementModule()
Method Detail |
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 modenConf, java.sql.Connection conn, java.sql.Statement stmt, java.util.Map objectModel) throws java.sql.SQLException, org.apache.avalon.framework.configuration.ConfigurationException
AutoIncrementModule
getPostValue
in interface AutoIncrementModule
tableConf
- Table's configuration from resource description.columnConf
- column's configuration from resource description.conn
- Connectionstmt
- Statement that was executed to insert the last row.
java.sql.SQLException
org.apache.avalon.framework.configuration.ConfigurationException
public boolean includeInQuery()
AutoIncrementModule
includeInQuery
in interface AutoIncrementModule
public boolean includeAsValue()
AutoIncrementModule
includeAsValue
in interface AutoIncrementModule
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
AutoIncrementModule
getPreValue
in interface AutoIncrementModule
tableConf
- Table's configuration from resource description.columnConf
- column's configuration from resource description.conn
- Connection
java.sql.SQLException
org.apache.avalon.framework.configuration.ConfigurationException
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
AutoIncrementModule
getSubquery
in interface AutoIncrementModule
org.apache.avalon.framework.configuration.ConfigurationException
protected final void setSelectQuery(java.lang.String tableName, org.apache.avalon.framework.configuration.Configuration entry) throws org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.configuration.ConfigurationException
protected final java.lang.String getSelectQuery(java.lang.String tableName, org.apache.avalon.framework.configuration.Configuration entry) throws org.apache.avalon.framework.configuration.ConfigurationException
org.apache.avalon.framework.configuration.ConfigurationException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |