|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.adapter.gsa.SQLProcessor
public class SQLProcessor
A generic class to execute SQL actions against a database. Parts copied from atg.service.idgen.?? by mgk
Constructor Summary | |
---|---|
SQLProcessor(javax.transaction.TransactionManager pTxManager,
javax.sql.DataSource pDataSource)
Construct with specified DataSource |
|
SQLProcessor(javax.transaction.TransactionManager pTxManager,
java.lang.String pUsername,
java.lang.String pPassword,
java.lang.String pDriver,
java.lang.String pURL)
Constructor with specified user/password/driver/URL. |
Method Summary | |
---|---|
static javax.sql.DataSource |
createBasicDataSource(java.lang.String pUsername,
java.lang.String pPassword,
java.lang.String pDriver,
java.lang.String pURL)
creates and returns a DataSource based on the user/pwd/driver/url info supplied. |
void |
dropTables(java.util.Collection<java.lang.String> pNames,
boolean pCascadeConstraints,
boolean pPreview)
Method that iteratively attempts to drop tables. |
java.util.List<?> |
executeQuery(java.lang.String pQuery,
java.lang.String pColumnName)
executes the specified query and returns a List of values for the specified column name. |
void |
executeSQL(java.lang.String pSQL)
Perform the specified SQL statement in a new transaction which is commited. |
java.lang.String |
getCreateTableBeginDelimiter()
|
java.lang.String |
getCreateTableEndDelimiter()
|
javax.sql.DataSource |
getDataSource()
returns the DataSource from which db connections are obtained |
java.lang.String |
getDetermineTableExistsSQL()
returns String executed to determine whether a table exists. |
java.lang.String |
getDropTableSQL()
returns String executed to drop a table. |
atg.nucleus.GenericService |
getLoggingManager()
|
javax.transaction.TransactionManager |
getTransactionManager()
returns the TransactionManager that should be used to monitor transaction |
boolean |
isSetAutoCommit()
returns true if autoCommit should be set to true on all connections used to execute SQL. |
void |
setAutoCommit(boolean pCommit)
if set to true, then autoCommit will be set to true on all connections used to execute SQL. |
void |
setCreateTableBeginDelimiter(java.lang.String pStr)
|
void |
setCreateTableEndDelimiter(java.lang.String pStr)
|
void |
setDataSource(javax.sql.DataSource pDataSource)
sets the DataSource from which to get DB connections |
void |
setDetermineTableExistsSQL(java.lang.String pStr)
sets String executed to determine whether a table exists. |
void |
setDropTableSQL(java.lang.String pStr)
sets String executed to drop a table. |
void |
setLoggingManager(atg.nucleus.GenericService pLogger)
|
void |
setTransactionManager(javax.transaction.TransactionManager pManager)
sets the TransactionManager that should be used to monitor transactions |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SQLProcessor(javax.transaction.TransactionManager pTxManager, javax.sql.DataSource pDataSource)
TransactionManager
- manager - the TransactionManager to use to monitor transactionsDataSource
- dataSource - the DataSource to use for db connectionspublic SQLProcessor(javax.transaction.TransactionManager pTxManager, java.lang.String pUsername, java.lang.String pPassword, java.lang.String pDriver, java.lang.String pURL) throws java.sql.SQLException
TransactionManager
- manager - the TransactionManager to use to monitor transactionsString
- username - name of user to connect to dbString
- password - pwd to connectc to dbString
- driver - driver specification to connect to dbString
- url - url to connect to db
java.sql.SQLException
- if an error occurs creating the DataSourceMethod Detail |
---|
public void setDataSource(javax.sql.DataSource pDataSource)
public javax.sql.DataSource getDataSource()
public void setTransactionManager(javax.transaction.TransactionManager pManager)
public javax.transaction.TransactionManager getTransactionManager()
public void setDetermineTableExistsSQL(java.lang.String pStr)
public java.lang.String getDetermineTableExistsSQL()
public void setDropTableSQL(java.lang.String pStr)
public java.lang.String getDropTableSQL()
public void setCreateTableBeginDelimiter(java.lang.String pStr)
public java.lang.String getCreateTableBeginDelimiter()
public void setCreateTableEndDelimiter(java.lang.String pStr)
public java.lang.String getCreateTableEndDelimiter()
public void setLoggingManager(atg.nucleus.GenericService pLogger)
public atg.nucleus.GenericService getLoggingManager()
public void setAutoCommit(boolean pCommit)
public boolean isSetAutoCommit()
public static javax.sql.DataSource createBasicDataSource(java.lang.String pUsername, java.lang.String pPassword, java.lang.String pDriver, java.lang.String pURL)
public void executeSQL(java.lang.String pSQL) throws java.sql.SQLException, atg.dtm.TransactionDemarcationException
pSQL
- SQL to execute
java.sql.SQLException
- if there is DB problem
atg.dtm.TransactionDemarcationException
- if there is a tx problempublic java.util.List<?> executeQuery(java.lang.String pQuery, java.lang.String pColumnName) throws java.sql.SQLException, atg.dtm.TransactionDemarcationException
java.sql.SQLException
- if a sql error occurs
atg.dtm.TransactionDemarcationException
- if a tx error occurspublic void dropTables(java.util.Collection<java.lang.String> pNames, boolean pCascadeConstraints, boolean pPreview) throws java.sql.SQLException, atg.dtm.TransactionDemarcationException
Collection
- of names of tables to be droppedboolean
- cascadeConstraints. true if 'CASCADE CONSTRAINTS' should be used in
drop statement.boolean
- preview. if true then iterative behavior is disabled and method simply
prints one drop statement that would be executed for each table. iterative behavior has
to be disabled since it doesn't make sense if drops are not being executed.
java.sql.SQLException
- thrown if all tables can not be dropped
atg.dtm.TransactionDemarcationException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |