|
DODS API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.webdocwf.util.sql.SQLSplitter
Class SQLSplitter copies all SQL commands from all SQL files which are situated in the working directory and all its subdirectories into new SQL files. Original SQL files are created by DODS - Enhydra. All SQL commands are copied into first sql file except sql commands which reference to foreign and primary key columns. In the second sql file class puts ALTER TABLE sql commands with adding foreign key references. In the third sql file class puts ALTER TABLE sql commands with adding primary keys. In the forth sql file class puts DROP TABLE sql commands for all tables which were created by create table SQL statements in the first file. In the fifth sql file class puts CREATE INDEX sql commands for all tables which were created by create table SQL statements in the first file. In the sixth sql file class puts DROP foreign key sql commands for all tables which were created by create table SQL statements in the first file. In the seventh sql file class puts DROP primary sql commands for all tables which created by create table SQL statements in the first file. All others Sql commands class puts into separate file.
Constructor Summary | |
SQLSplitter()
Constructor SQLSplitter without parameters. |
Method Summary | |
void |
addForeignKeyValues(java.lang.String strTableName,
java.lang.String strForeignTable,
java.lang.String strForeignKey,
java.lang.String strPrimaryKey,
java.lang.String strReference,
java.lang.String strConstraint)
Method addForeignKeyValues adds values to global variables - vectors. |
void |
addIndexValues(java.lang.String strIndex)
Method addIndexValues adds values to global variables - vectors. |
void |
addPrimaryKeyValues(java.lang.String strTableName,
java.lang.String strPrimaryColumn,
java.lang.String strConstraintPrimary)
Method addPrimaryKeyValues adds values to global variables - vectors. |
void |
addTableName(java.lang.String strTableName)
Method addTableName adds values to global variables - vectors. |
void |
createSQLFile(java.io.File fInputSQLFile,
java.io.File fCreateTable,
java.io.File fOther)
Method createSQLFile prepares SQL statements for all output files and creates SQL file (fOutputSQLFile) with CREATE TABLE statements. |
java.util.Vector |
findSQLFiles(java.io.File fDirectory)
Method findSQLFiles finds all SQL files (all files which contain ".sql" in their name) in a working directory and all its subdirecories and puts their URL's into Vector. |
static void |
main(java.lang.String[] argv)
Main method controls parameters, if they are OK, starts separateSqlCommands method, but if they aren't, makes alert. |
void |
separateSqlCommands(java.lang.String strDirectory,
java.lang.String strOutputFile)
Method separateSqlCommands analyses all SQL files in a working directory and all its subdirecories and puts all create table SQL statements without Foreign references and Primary keys into separate file. |
void |
writeAlterTableForeignKey(java.io.File fOutputAlterTable)
Method writeAlterTableForeignKey creates SQL file with ALTER TABLE SQL commands (foreign key references). |
void |
writeAlterTableIndex(java.io.File fOutputAlterTableIndex)
Method writeAlterTableIndex creates SQL file with CREATE INDEX SQL commands. |
void |
writeAlterTablePrimaryKey(java.io.File fOutputAlterTable)
Method writeAlterTablePrimaryKey createss SQL file with ALTER TABLE SQL commands (primary keys for all tables). |
void |
writeDropIntegrity(java.io.File fOutputDropIntegrity)
Method writeDropIntegrity creates SQL file with ALTER TABLE SQL commands (drop foreign key references). |
void |
writeDropPrimary(java.io.File fOutputDropPrimary)
Method writeDropPrimary creates SQL file with ALTER TABLE SQL commands (drop primary keys). |
void |
writeDropTable(java.io.File fOutputDropTable)
Method writeDropTable creates SQL file with DROP TABLE SQL commands. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SQLSplitter()
Method Detail |
public static void main(java.lang.String[] argv)
public void separateSqlCommands(java.lang.String strDirectory, java.lang.String strOutputFile)
strDirectory
- The URL of the working directory.strOutputFile
- The Url and basic name of the output SQL files(example: c:\tmp\new_SQL.sql).public java.util.Vector findSQLFiles(java.io.File fDirectory)
fDirectory
- The URL of the working directory.
public void createSQLFile(java.io.File fInputSQLFile, java.io.File fCreateTable, java.io.File fOther)
fInputSQLFile
- The URL of the input SQL file.
Exception.
public void addForeignKeyValues(java.lang.String strTableName, java.lang.String strForeignTable, java.lang.String strForeignKey, java.lang.String strPrimaryKey, java.lang.String strReference, java.lang.String strConstraint)
strTableName
- Name of table where the foreign key SQL statement was found.strForeignTable
- 'Foreign table'.strForeignKey
- Column in the table 'strTablename' which is referenced by foreign key.strPrimaryKey
- Column in the table 'strForeignTable' - primary key.strReference
- Sql commands after foreign key columns (such as ON DELETE CASCADE).strConstraint
- Name of Foreign Key constraint.public void addPrimaryKeyValues(java.lang.String strTableName, java.lang.String strPrimaryColumn, java.lang.String strConstraintPrimary)
strTableName
- Name of table where the primary key SQL statement was found.strPrimaryColumn
- Name of column which is primary key.strConstraintPrimary
- Name of Primary key constraint.public void addTableName(java.lang.String strTableName)
strTableName
- Name of table which it will be deleted.public void addIndexValues(java.lang.String strIndex)
strIndex
- All create index SQL statements.public void writeAlterTableForeignKey(java.io.File fOutputAlterTable)
fOutputAlterTable
- The URL of the output SQL file.
Exception.
public void writeDropIntegrity(java.io.File fOutputDropIntegrity)
fOutputDropIntegrity
- The URL of the output SQL file.
Exception.
public void writeDropPrimary(java.io.File fOutputDropPrimary)
fOutputDropPrimary
- The URL of the output SQL file.
Exception.
public void writeAlterTablePrimaryKey(java.io.File fOutputAlterTable)
fOutputAlterTable
- The URL of the output SQL file.
Exception.
public void writeDropTable(java.io.File fOutputDropTable)
fOutputDropTable
- The URL of the output SQL file.
Exception.
public void writeAlterTableIndex(java.io.File fOutputAlterTableIndex)
fOutputAlterTableIndex
- The URL of the output SQL file.
Exception.
|
DODS API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |