javatools.db
Class DbDatabaseAdmin

java.lang.Object
  |
  +--javatools.db.DbDatabase
        |
        +--javatools.db.DbDatabaseAdmin

public class DbDatabaseAdmin
extends DbDatabase

Class to manage administrator functions.


Field Summary
 
Fields inherited from class javatools.db.DbDatabase
checkStatement, foreignKey, onDeleteCascade, onDeleteSetDefault, onDeleteSetNull, onUpdateCascade, onUpdateSetDefault, onUpdateSetNull
 
Constructor Summary
DbDatabaseAdmin(DbDatabase base)
          Creates new DbDatabaseAdmin
DbDatabaseAdmin(DbManager manager, java.lang.String name, java.lang.String driver, java.lang.String connectString, java.lang.String userName, java.lang.String password)
          Creates new DbDatabaseAdmin
 
Method Summary
 void createDatabase(java.lang.String dbName)
          Creates a database.
 void createIndex(java.lang.String indexName, DbAbstractTable table, DbColumn[] cols)
          Creates an index for a database.
 void dropDatabase(java.lang.String dbName)
          Destroys a database.
 void dropTable(DbAbstractTable table)
          Deletes a table from a database.
 void optimizeIndex(java.lang.String indexName)
          Optimizes an index for the database.
 void optimizeTable(DbAbstractTable table)
          Make table optimization.
 
Methods inherited from class javatools.db.DbDatabase
equals, falseExpr, getCheckStatement, getExistingThreadConnection, getForeignKey, getJoinedTable, getNewConnection, getOnDeleteCascade, getOnDeleteSetDefault, getOnDeleteSetNull, getOnUpdateCascade, getOnUpdateSetDefault, getOnUpdateSetNull, getProperty, getSequence, getTable, getThreadConnection, hasThreadConnection, selector, setAutoCommit, setProperty, toString, trueExpr, valueList
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DbDatabaseAdmin

public DbDatabaseAdmin(DbManager manager,
                       java.lang.String name,
                       java.lang.String driver,
                       java.lang.String connectString,
                       java.lang.String userName,
                       java.lang.String password)
Creates new DbDatabaseAdmin

Parameters:
manager - The manager for getting properties file.
name - Name of DBMS.
driver - Driver used to connect to DBMS.
connectString - Connection string to connect to DBMS.
userName - User name to connect to DBMS. It must not be included into connectString!
password - Password to connect to DBMS. It must not be included into connectString!

DbDatabaseAdmin

public DbDatabaseAdmin(DbDatabase base)
Creates new DbDatabaseAdmin

Parameters:
base - The database to use.
Method Detail

createDatabase

public void createDatabase(java.lang.String dbName)
                    throws DbException
Creates a database.

Parameters:
dbName - Name of database to be created.
Throws:
DbException - If something goes wrong.

dropDatabase

public void dropDatabase(java.lang.String dbName)
                  throws DbException
Destroys a database.

Parameters:
dbName - Database to be destroyed.
Throws:
DbException - If something goes wrong.

dropTable

public void dropTable(DbAbstractTable table)
               throws DbException
Deletes a table from a database.

Parameters:
table - The table to remove.
Throws:
DbException - If something goes wrong.

optimizeTable

public void optimizeTable(DbAbstractTable table)
                   throws DbException
Make table optimization.

Parameters:
table - The table to optimize.
Throws:
DbException - If something goes wrong.

optimizeIndex

public void optimizeIndex(java.lang.String indexName)
                   throws DbException
Optimizes an index for the database.

Parameters:
indexName - The index name.
Throws:
DbException - If something goes wrong.

createIndex

public void createIndex(java.lang.String indexName,
                        DbAbstractTable table,
                        DbColumn[] cols)
                 throws DbException
Creates an index for a database.

Parameters:
indexName - The index name.
table - The table to use.
cols - The columns to be indexed.
Throws:
DbException - If something goes wrong.