|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--tppt.db.DBHandler
This class is the abstract class that defined the required methods for the any DBMS that tool would like to run on. The methods with implementation are those methods have same behaviors (or said independent) between different DBMS. The abstract methods are those methods that are dependent on the DBMS - different DBMS needs different implementation. Therefore, if you would like to extend the tool to support any other DBMS besides DB2 and Sybase then you have to create the own DB handler for that new DBMS and new DB handler have to extend this class and implement the required abstract methods.
Field Summary | |
protected java.sql.Connection |
connection
DB Connection |
Constructor Summary | |
DBHandler()
|
Method Summary | |
void |
closeConnection()
|
private void |
closeReader(java.io.Reader reader)
Close the file reader. |
boolean |
dbConnection(java.lang.String id,
java.lang.String passd,
java.lang.String u,
java.lang.String d,
java.lang.String p)
Create the connection to the database. |
boolean |
dropATable(java.lang.String tableName)
Drop a table with name tableName . |
boolean |
dropConstraint(java.lang.String cname,
java.lang.String tname)
Drop the specific constraint for specific table. |
boolean |
dropSP(java.lang.String spName)
Drop a specific store procedure with name spName . |
abstract void |
dropStoredProcedures()
The method to obtain all the existing stored procedures and then call dropSP method to drop those stored procedure before the experiment starts. |
abstract void |
dropTables()
The method to obtain all the existing tables and constraints and then call dropConstraint and dropATable methods to drop all the constraints and tables before the experiment starts. |
boolean |
executeStmt(java.lang.String s)
Execute the SQL command. |
boolean |
initDB()
This method executes the initial tasks before the experiment starts. |
boolean |
initStatement(java.lang.String fileName,
int mode)
Read the sql commands from the filename and execute those
commands. |
static void |
main(java.lang.String[] args)
|
abstract boolean |
setMaxRowsForTable(java.sql.CallableStatement sp,
java.lang.String table)
This method used to set up the maximun rows for a table. |
abstract boolean |
setMaxRowsPerPage()
Set up the maximum row per page for all the user created tables. table. |
boolean |
SQLFileExecutor(java.lang.String file,
java.lang.String db)
New version of initial procedure for "sync.xml". |
boolean |
twoPhaseDBInit(java.lang.String file)
This method is used to parse the XML format DB initialization file for two-phase commit experiment. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected java.sql.Connection connection
Constructor Detail |
public DBHandler()
Method Detail |
public abstract void dropStoredProcedures()
dropSP(java.lang.String)
public abstract void dropTables()
dropATable(java.lang.String)
,
dropConstraint(java.lang.String, java.lang.String)
public abstract boolean setMaxRowsForTable(java.sql.CallableStatement sp, java.lang.String table)
sp
- the CallableStatement to execute the maximun-rows setup.table
- the table name.public abstract boolean setMaxRowsPerPage()
setMaxRowsForTable(CallableStatement,String)
public boolean dbConnection(java.lang.String id, java.lang.String passd, java.lang.String u, java.lang.String d, java.lang.String p)
public boolean dropConstraint(java.lang.String cname, java.lang.String tname)
cname
- the name of constraint.tname
- the name of table.public boolean dropSP(java.lang.String spName)
spName
.spName
- the name of store procedure.public boolean dropATable(java.lang.String tableName)
tableName
.public void closeConnection()
private void closeReader(java.io.Reader reader)
reader
- public boolean executeStmt(java.lang.String s)
the
- string of SQL command.public boolean initDB()
dbConnection(String,String,String,String,String)
,
dropTables()
,
dropStoredProcedures()
,
initStatement(String,int)
,
closeConnection()
,
setMaxRowsPerPage()
,
GlobalData.dbSchemaFile
,
GlobalData.dbInitFile
public boolean initStatement(java.lang.String fileName, int mode)
filename
and execute those
commands.SQL
- script filemode:1
- from Jar ,2 from file system.public boolean SQLFileExecutor(java.lang.String file, java.lang.String db)
xml
- filethe
- name of DBMS - DB2 or Sybasepublic boolean twoPhaseDBInit(java.lang.String file)
file
- the db initialization filepublic static void main(java.lang.String[] args) throws java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |