org.riverock.dbrevision.db
Class DatabaseStructureManager

java.lang.Object
  extended by org.riverock.dbrevision.db.DatabaseStructureManager

public class DatabaseStructureManager
extends Object

Author:
SergeMaslyukov Date: 20.12.2005 Time: 1:07:54 $Id: DatabaseStructureManager.java 1141 2006-12-14 14:43:29Z serg_main $

Constructor Summary
DatabaseStructureManager()
           
 
Method Summary
static void addColumn(Database adapter, String tableName, DbField field)
          add column to table
static DbField cloneDescriptionField(DbField srcField)
           
static DbForeignKey cloneDescriptionFK(DbForeignKey srcFk)
           
static DbPrimaryKey cloneDescriptionPK(DbPrimaryKey srcPk)
           
static DbPrimaryKeyColumn cloneDescriptionPrimaryKeyColumn(DbPrimaryKeyColumn srcCol)
           
static DbTable cloneDescriptionTable(DbTable srcTable)
          Clone description of table.
static void copyFieldData(Database db_, DbTable table, DbField sourceField, DbField targetField)
           
static void createForeignKey(Database adapter, DbForeignKey fk)
          create foreign key
static DbKeyActionRule decodeDeferrabilityRule(ResultSet rs)
           
static DbKeyActionRule decodeDeleteRule(ResultSet rs)
           
static DbKeyActionRule decodeUpdateRule(ResultSet rs)
           
static void dropColumn(Database adapter, DbTable table, DbField field)
          drop field from specified table
static void dropView(Database adapter, DbView view)
           
static DbDataTable getDataTable(Database adapter, DbTable table)
           
static List<DbField> getFieldsList(Database adapter, String schemaPattern, String tablePattern)
           
static List<DbForeignKey> getForeignKeys(Database adapter, String schemaName, String tableName)
          Return info about all PK for tables, which referenced from current table(tableName)
static List<DbIndex> getIndexes(Database adapter, String schemaName, String tableName)
           
static DbPrimaryKey getPrimaryKey(Database adapter, String schemaPattern, String tablePattern)
           
static List<DbTable> getTableList(Connection conn1, String schemaPattern, String tablePattern)
          Return filtered list of tables usually schemaPattern is a db username if tablePattern equals "%", this mean what selected all tables
static void setDataTable(Database adapter, DbTable table)
           
static void setDefaultValueTimestamp(Database adapter, DbTable originTable, DbField originField)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseStructureManager

public DatabaseStructureManager()
Method Detail

createForeignKey

public static void createForeignKey(Database adapter,
                                    DbForeignKey fk)
create foreign key

Parameters:
adapter - db adapter
fk - list of foreign keys

addColumn

public static void addColumn(Database adapter,
                             String tableName,
                             DbField field)
add column to table

Parameters:
adapter - db adapter
tableName - table name
field - column descriptor

dropColumn

public static void dropColumn(Database adapter,
                              DbTable table,
                              DbField field)
drop field from specified table

Parameters:
adapter - db adapter
table - table definition
field - field to drop

dropView

public static void dropView(Database adapter,
                            DbView view)

setDataTable

public static void setDataTable(Database adapter,
                                DbTable table)

getDataTable

public static DbDataTable getDataTable(Database adapter,
                                       DbTable table)
Parameters:
adapter - db adapter
table - table for get data
Returns:
DbDataTable

getTableList

public static List<DbTable> getTableList(Connection conn1,
                                         String schemaPattern,
                                         String tablePattern)
Return filtered list of tables usually schemaPattern is a db username if tablePattern equals "%", this mean what selected all tables

Parameters:
conn1 - db connection
schemaPattern - schema name filter
tablePattern - table name filter
Returns:
List of DbTable

getFieldsList

public static List<DbField> getFieldsList(Database adapter,
                                          String schemaPattern,
                                          String tablePattern)
Parameters:
adapter - db adapter
schemaPattern - String
tablePattern - String
Returns:
ArrayList

getIndexes

public static List<DbIndex> getIndexes(Database adapter,
                                       String schemaName,
                                       String tableName)

getForeignKeys

public static List<DbForeignKey> getForeignKeys(Database adapter,
                                                String schemaName,
                                                String tableName)
Return info about all PK for tables, which referenced from current table(tableName)

Parameters:
adapter - db adapter
tableName - name of table
schemaName - name of schema
Returns:
List

getPrimaryKey

public static DbPrimaryKey getPrimaryKey(Database adapter,
                                         String schemaPattern,
                                         String tablePattern)

setDefaultValueTimestamp

public static void setDefaultValueTimestamp(Database adapter,
                                            DbTable originTable,
                                            DbField originField)

decodeUpdateRule

public static DbKeyActionRule decodeUpdateRule(ResultSet rs)

decodeDeleteRule

public static DbKeyActionRule decodeDeleteRule(ResultSet rs)

decodeDeferrabilityRule

public static DbKeyActionRule decodeDeferrabilityRule(ResultSet rs)

cloneDescriptionPrimaryKeyColumn

public static DbPrimaryKeyColumn cloneDescriptionPrimaryKeyColumn(DbPrimaryKeyColumn srcCol)

cloneDescriptionFK

public static DbForeignKey cloneDescriptionFK(DbForeignKey srcFk)

cloneDescriptionPK

public static DbPrimaryKey cloneDescriptionPK(DbPrimaryKey srcPk)

cloneDescriptionField

public static DbField cloneDescriptionField(DbField srcField)

cloneDescriptionTable

public static DbTable cloneDescriptionTable(DbTable srcTable)
Clone description of table. Data not cloned

Parameters:
srcTable - source table
Returns:
DbTable cloned table

copyFieldData

public static void copyFieldData(Database db_,
                                 DbTable table,
                                 DbField sourceField,
                                 DbField targetField)


Copyright © 2008 Riverock community. All Rights Reserved.