dke.smwp.db
Class DB_Table

java.lang.Object
  |
  +--dke.smwp.db.DB_Table
Direct Known Subclasses:
DB_FragmentClass, DB_Parameter

public class DB_Table
extends java.lang.Object

class for table handling; creates and drops relations;

Version:
1.0
Author:
Werner Enser

Field Summary
private  ConnectionPool _connectionPool
          connection pool handle
 
Constructor Summary
DB_Table()
          default constructor
 
Method Summary
 boolean columnExists(java.lang.String tableName, java.lang.String columnName)
          checks if column exists within given table
 boolean dropTable(java.lang.String tableName)
          deletes table designated by table_name
 Column getColumn(java.lang.String table_name, java.lang.String column_name)
          fetches column object from given table and column name
 java.util.ArrayList getColumns(java.lang.String tableName)
          fetches all columns as Column objects from given table into an ArrayList
 java.util.ArrayList getColumns(java.lang.String tableName, java.lang.String[] columnNames)
          fetches all columns as Column objects from given table and given column names into ArrayList
 java.util.ArrayList getForeignKeys(java.lang.String tablename)
          get foreign key constraints of table designated by tablename
 java.util.ArrayList getPrimaryKeys(java.lang.String tablename)
          get column names of table which are primary key
 java.lang.String stingReplace(java.lang.String sourceString, java.lang.String searchPattern, java.lang.String replacePattern)
          replace all occurrences of searchPattern in sourceString with replacePattern
 boolean tableExists(java.lang.String tableName)
          check if table designated by table_name exists in database
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

_connectionPool

private ConnectionPool _connectionPool
connection pool handle
Constructor Detail

DB_Table

public DB_Table()
default constructor
Method Detail

dropTable

public boolean dropTable(java.lang.String tableName)
deletes table designated by table_name
Parameters:
tableName - name of table which is to be deleted

tableExists

public boolean tableExists(java.lang.String tableName)
check if table designated by table_name exists in database
Parameters:
tableName - table name which is to be checked

columnExists

public boolean columnExists(java.lang.String tableName,
                            java.lang.String columnName)
checks if column exists within given table
Parameters:
tableName - table name in which the column is searched
columnName - column name which is to be checked

getColumn

public Column getColumn(java.lang.String table_name,
                        java.lang.String column_name)
fetches column object from given table and column name
Parameters:
table_name - table name whose column is to be fetched
column_name - name of column which is to be fetched

getColumns

public java.util.ArrayList getColumns(java.lang.String tableName)
fetches all columns as Column objects from given table into an ArrayList
Parameters:
tableName - name of table whose columns are to be fetched
Returns:
Collection containing Column objects

getColumns

public java.util.ArrayList getColumns(java.lang.String tableName,
                                      java.lang.String[] columnNames)
fetches all columns as Column objects from given table and given column names into ArrayList
Parameters:
tableName - name of table whose columns are to be fetched
columnNames - names of columns, which are to be fetched
Returns:
Collection containing Column objects

getForeignKeys

public java.util.ArrayList getForeignKeys(java.lang.String tablename)
get foreign key constraints of table designated by tablename
Parameters:
tablename - name of table whose foreign key constraints are checked

getPrimaryKeys

public java.util.ArrayList getPrimaryKeys(java.lang.String tablename)
get column names of table which are primary key
Parameters:
tablename - name of table whose primary key columns are checked
Returns:
collection containing column names which are used as primary keys

stingReplace

public java.lang.String stingReplace(java.lang.String sourceString,
                                     java.lang.String searchPattern,
                                     java.lang.String replacePattern)
replace all occurrences of searchPattern in sourceString with replacePattern
Parameters:
sourceString - string which is to be modified
searchPattern - string pattern which is to be replaced
replacePattern - string which replaces searchPattern