OSDN Git Service

20170423
[rapideact/rapideact.git] / com / rapide_act / RapideMetaUnloader.java
index 72867b8..6cb24ba 100644 (file)
@@ -26,29 +26,22 @@ import java.sql.Blob;
 import java.sql.Clob;
 
 public class RapideMetaUnloader{
-       protected static final int FL_TABLE = 0;
-       protected static final int FL_INDEX = 1;
-       protected static final int FL_VIEW = 2;
-       protected static final int FL_PROCEDURE = 3;
-       protected static final int FL_SEQ = 4;
-       protected static final int FL_SYNONYM = 5;
-       protected static final int FL_DBLINK = 6;
-       protected static final int FL_OBJPRIVS = 7;
-       protected static final int FL_SYSPRIVS = 8;
-       protected static final int FL_ROLEPRIVS = 9;
-       protected static final int FL_OBJ = 10;
-       protected static final int FL_FK = 11;
-       protected static final String [] FILE_NAME = {
+
+       private static final int FL_TABLE = 0;
+       private static final int FL_INDEX = 1;
+       private static final int FL_VIEW = 2;
+       private static final int FL_PROCEDURE = 3;
+       private static final int FL_SEQ = 4;
+       private static final int FL_SYNONYM = 5;
+       private static final int FL_OBJ = 6;
+       private static final int FL_FK = 7;
+       private static final String [] FILE_NAME = {
                "TABLEDEF",
                "INDEXDEF",
                "VIEWDEF",
                "PROCDEF",
                "SEQDEF",
                "SYNMDEF",
-               "DBLNKDEF",
-               "OBJPRVDEF",
-               "SYSPRVDEF",
-               "ROLPRVDEF",
                "OBJDEF",
                "FKDEF"
        };
@@ -122,41 +115,12 @@ public class RapideMetaUnloader{
             + " from user_sequences "
             + " order by sequence_name",
        "select "
-            + "  owner,"
             + "  synonym_name,"
             + "  table_owner,"
             + "  table_name,"
             + "  db_link "
-            + "from all_synonyms "
-            + "order by owner,synonym_name,table_name",
-       "select "
-            + "  db_link,"
-            + "  username,"
-            + "  password,"
-            + "  host,"
-            + "  created "
-            + "from user_db_links "
-            + "order by db_link",
-       "select "
-            + "  grantee,"
-            + "  owner,"
-            + "  table_name,"
-            + "  grantor,"
-            + "  privilege,"
-            + "  grantable,"
-            + "  hierarchy "
-            + "from user_tab_privs "
-            + "order by grantee,owner,table_name,grantor,privilege",
-       "select "
-            + "  username,"
-            + "  privilege "
-            + "from user_sys_privs "
-            + "order by username,privilege",
-       "select "
-            + "  username,"
-            + "  granted_role "
-            + "from user_role_privs "
-            + "order by username,granted_role",
+            + "from user_synonyms "
+            + "order by synonym_name,table_owner,table_name",
        "select "
             + " a.table_name,"
             + " a.object_name,"
@@ -392,9 +356,9 @@ public class RapideMetaUnloader{
                        br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_TABLE] + "_" + database +".csv"));
                        subFolder = new File(folder + "/TABLES");
                        subFolder.mkdir();
-                       pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "createTable.sql"))));
-                       pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "dropTable.sql"))));
-                       pw[3] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "truncateTable.sql"))));
+                       pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_TABLE]))));
+                       pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_TABLE]))));
+                       pw[3] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.TRUNCATE_TABLE]))));
 
                        tableName = "";
                        tableCmnt = "";
@@ -412,9 +376,9 @@ public class RapideMetaUnloader{
                                if(!strLine.equals("")){
                                        strSplit = CmnUtils.splitCsv(strLine);
                                        if (!tableName.equals("")){
-                                               sbTbCnts.append("    " + colName);
+                                               sbTbCnts.append("    " + cp.sqlQuoted + colName + cp.sqlQuoted);
                                                sbTbCnts.append(" " + colType);
-                                               if(!colCmnt.equals(""))sbTbCmnt.append("COMMENT ON COLUMN " + tableName + "." + colName + " IS '" + colCmnt + "';");
+                                               if(!colCmnt.equals(""))sbTbCmnt.append("COMMENT ON COLUMN " + cp.sqlQuoted + tableName + cp.sqlQuoted + "." + cp.sqlQuoted + colName + cp.sqlQuoted + " IS '" + colCmnt + "';");
                                                if(!colCmnt.equals(""))sbTbCmnt.append(cp.lineSeparator);
                                                if (!colType.equals("BLOB") && !colType.equals("CLOB") && !colType.equals("TIMESTAMP") && !colType.equals("DATE") && !colType.equals("LONG") && !colType.equals("LONG RAW")){
                                                        if (!colLen.equals(""))sbTbCnts.append("(" + colLen);
@@ -425,8 +389,8 @@ public class RapideMetaUnloader{
                                                if (colNoN.equals("\81\9b"))sbTbCnts.append(" NOT NULL");
                                                if (!strSplit[0].equals(tableName)){
                                                        pw[1].println("@TABLES/" + tableName + ".sql");
-                                                       pw[2].println("DROP TABLE " + tableName + " PURGE;");
-                                                       pw[3].println("TRUNCATE TABLE " + tableName + ";");
+                                                       pw[2].println("DROP TABLE " + cp.sqlQuoted + tableName + cp.sqlQuoted + " PURGE;");
+                                                       pw[3].println("TRUNCATE TABLE " + cp.sqlQuoted + tableName + cp.sqlQuoted + ";");
                                                        sbTbCnts.append(cp.lineSeparator);
                                                        sbTbCnts.append(");");
                                                        sbTbCnts.append(cp.lineSeparator);
@@ -439,11 +403,11 @@ public class RapideMetaUnloader{
                                                        pw[0] = null;
                                                        sbTbCnts = new StringBuffer();
                                                        sbTbCmnt = new StringBuffer();
-                                                       sbTbCnts.append("CREATE TABLE " + strSplit[0]);
+                                                       sbTbCnts.append("CREATE TABLE " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted);
                                                        sbTbCnts.append(cp.lineSeparator);
                                                        sbTbCnts.append("(");
                                                        sbTbCnts.append(cp.lineSeparator);
-                                                       if(!strSplit[1].equals(""))sbTbCmnt.append("COMMENT ON TABLE " + strSplit[0] + " IS '" + strSplit[1] +"';");
+                                                       if(!strSplit[1].equals(""))sbTbCmnt.append("COMMENT ON TABLE " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted + " IS '" + strSplit[1] +"';");
                                                        if(!strSplit[1].equals(""))sbTbCmnt.append(cp.lineSeparator);
                                                } else {
                                                        sbTbCnts.append(",");
@@ -451,11 +415,11 @@ public class RapideMetaUnloader{
                                                }
                                        }
                                        else {
-                                               sbTbCnts.append("CREATE TABLE " + strSplit[0]);
+                                               sbTbCnts.append("CREATE TABLE " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted);
                                                sbTbCnts.append(cp.lineSeparator);
                                                sbTbCnts.append("(");
                                                sbTbCnts.append(cp.lineSeparator);
-                                               if(!strSplit[1].equals(""))sbTbCmnt.append("COMMENT ON TABLE " + strSplit[0] + " IS '" + strSplit[1] +"';");
+                                               if(!strSplit[1].equals(""))sbTbCmnt.append("COMMENT ON TABLE " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted + " IS '" + strSplit[1] +"';");
                                                if(!strSplit[1].equals(""))sbTbCmnt.append(cp.lineSeparator);
                                        }
                                        for(int i=0;i<strSplit.length;i++)CmnUtils.debugPrint("'" + strSplit[i] + "'");
@@ -473,9 +437,9 @@ public class RapideMetaUnloader{
                        }
 
                        if (!tableName.equals("")){
-                               sbTbCnts.append("    " + colName);
+                               sbTbCnts.append("    " + cp.sqlQuoted + colName + cp.sqlQuoted);
                                sbTbCnts.append(" " + colType);
-                               if(!colCmnt.equals(""))sbTbCmnt.append("COMMENT ON COLUMN " + tableName + "." + colName + " IS '" + colCmnt + "';");
+                               if(!colCmnt.equals(""))sbTbCmnt.append("COMMENT ON COLUMN " + cp.sqlQuoted + tableName + cp.sqlQuoted + "." + cp.sqlQuoted + colName + cp.sqlQuoted + " IS '" + colCmnt + "';");
                                if(!colCmnt.equals(""))sbTbCmnt.append(cp.lineSeparator);
                                if (!colType.equals("BLOB") && !colType.equals("TIMESTAMP") && !colType.equals("DATE") && !colType.equals("LONG") && !colType.equals("LONG RAW")){
                                        if (!colLen.equals(""))sbTbCnts.append("(" + colLen);
@@ -485,8 +449,8 @@ public class RapideMetaUnloader{
                                if (!colDflt.equals(""))sbTbCnts.append(" DEFAULT " + colDflt.trim());
                                if (colNoN.equals("\81\9b"))sbTbCnts.append(" NOT NULL");
                                pw[1].println("@TABLES/" + tableName + ".sql");
-                               pw[2].println("DROP TABLE " + tableName + " PURGE;");
-                               pw[3].println("TRUNCATE TABLE " + tableName + ";");
+                               pw[2].println("DROP TABLE " + cp.sqlQuoted + tableName + cp.sqlQuoted + " PURGE;");
+                               pw[3].println("TRUNCATE TABLE " + cp.sqlQuoted + tableName + cp.sqlQuoted + ";");
                                sbTbCnts.append(cp.lineSeparator);
                                sbTbCnts.append(");");
                                sbTbCnts.append(cp.lineSeparator);
@@ -506,12 +470,12 @@ public class RapideMetaUnloader{
 
                        // Index Contents start
                        br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_INDEX] + "_" + database +".csv"));
-                       pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "createPrimaryKey.sql"))));
-                       pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "createUniqueKey.sql"))));
-                       pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "createIndex.sql"))));
-                       pw[3] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "dropPrimaryKey.sql"))));
-                       pw[4] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "dropUniqueKey.sql"))));
-                       pw[5] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "dropIndex.sql"))));
+                       pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY]))));
+                       pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY]))));
+                       pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX]))));
+                       pw[3] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_PKEY]))));
+                       pw[4] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_UKEY]))));
+                       pw[5] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_INDEX]))));
 
                        //Initial Process
                        tableName = "";
@@ -533,11 +497,11 @@ public class RapideMetaUnloader{
                                                if (!strSplit[1].equals(indexName)){
                                                        //Post Process
                                                        if (colPos.equals("1")){
-                                                               sbIxCnts.append(colName);
-                                                               if (constraintType.equals("U"))sbIx2Cnts.append(colName);
+                                                               sbIxCnts.append(cp.sqlQuoted + colName + cp.sqlQuoted);
+                                                               if (constraintType.equals("U"))sbIx2Cnts.append(cp.sqlQuoted + colName + cp.sqlQuoted);
                                                        } else {
-                                                               sbIxCnts.append(", " + colName);
-                                                               if (constraintType.equals("U"))sbIx2Cnts.append(", " + colName);
+                                                               sbIxCnts.append(", " + cp.sqlQuoted + colName + cp.sqlQuoted);
+                                                               if (constraintType.equals("U"))sbIx2Cnts.append(", " + cp.sqlQuoted + colName + cp.sqlQuoted);
                                                        }
                                                        sbIxCnts.append(");");
                                                        sbIxCnts.append(cp.lineSeparator);
@@ -570,22 +534,22 @@ public class RapideMetaUnloader{
 
                                                        //Index Changed Process
                                                        if (strSplit[3].equals("P")){
-                                                               sbIxCnts.append("ALTER TABLE " + strSplit[0] + " ADD CONSTRAINT " + strSplit[1] + " PRIMARY KEY(");
-                                                               sbIx2Cnts.append("ALTER TABLE " + strSplit[0] + " DROP CONSTRAINT " + strSplit[1] + ";");
+                                                               sbIxCnts.append("ALTER TABLE " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted + " ADD CONSTRAINT " + cp.sqlQuoted + strSplit[1] + cp.sqlQuoted + " PRIMARY KEY(");
+                                                               sbIx2Cnts.append("ALTER TABLE " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted + " DROP CONSTRAINT " + cp.sqlQuoted + strSplit[1] + cp.sqlQuoted + ";");
                                                        } else if (strSplit[3].equals("U")){
-                                                               sbIxCnts.append("ALTER TABLE " + strSplit[0] + " ADD CONSTRAINT " + strSplit[1] + " UNIQUE(");
-                                                               sbIx2Cnts.append("ALTER TABLE " + strSplit[0] + " DROP UNIQUE(");
+                                                               sbIxCnts.append("ALTER TABLE " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted + " ADD CONSTRAINT " + cp.sqlQuoted + strSplit[1] + cp.sqlQuoted + " UNIQUE(");
+                                                               sbIx2Cnts.append("ALTER TABLE " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted + " DROP UNIQUE(");
                                                        } else if (strSplit[3].equals("")){
-                                                               sbIxCnts.append("CREATE INDEX " + strSplit[1] + " ON " + strSplit[0] + "(");
+                                                               sbIxCnts.append("CREATE INDEX " + cp.sqlQuoted + strSplit[1] + cp.sqlQuoted + " ON " + strSplit[0] + "(");
                                                        }
-                                                       sbIx3Cnts.append("DROP INDEX " + strSplit[1] + ";");
+                                                       sbIx3Cnts.append("DROP INDEX " + cp.sqlQuoted + strSplit[1] + cp.sqlQuoted + ";");
                                                } else if (strSplit[1].equals(indexName)){
                                                        if (colPos.equals("1")){
-                                                               sbIxCnts.append(colName);
-                                                               if (constraintType.equals("U"))sbIx2Cnts.append(colName);
+                                                               sbIxCnts.append(cp.sqlQuoted + colName + cp.sqlQuoted);
+                                                               if (constraintType.equals("U"))sbIx2Cnts.append(cp.sqlQuoted + colName + cp.sqlQuoted);
                                                        } else {
-                                                               sbIxCnts.append(", " + colName);
-                                                               if (constraintType.equals("U"))sbIx2Cnts.append(", " + colName);
+                                                               sbIxCnts.append(", " + cp.sqlQuoted + colName + cp.sqlQuoted);
+                                                               if (constraintType.equals("U"))sbIx2Cnts.append(", " + cp.sqlQuoted + colName + cp.sqlQuoted);
                                                        }
                                                }
                                        }
@@ -593,15 +557,15 @@ public class RapideMetaUnloader{
                                        //1st Line Process
                                        else {
                                                if (strSplit[3].equals("P")){
-                                                       sbIxCnts.append("ALTER TABLE " + strSplit[0] + " ADD CONSTRAINT " + strSplit[1] + " PRIMARY KEY(");
-                                                       sbIx2Cnts.append("ALTER TABLE " + strSplit[0] + " DROP CONSTRAINT " + strSplit[1] + ";");
+                                                       sbIxCnts.append("ALTER TABLE " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted + " ADD CONSTRAINT " + cp.sqlQuoted + strSplit[1] + cp.sqlQuoted + " PRIMARY KEY(");
+                                                       sbIx2Cnts.append("ALTER TABLE " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted + " DROP CONSTRAINT " + cp.sqlQuoted + strSplit[1] + cp.sqlQuoted + ";");
                                                } else if (strSplit[3].equals("U")){
-                                                       sbIxCnts.append("ALTER TABLE " + strSplit[0] + " ADD CONSTRAINT " + strSplit[1] + " UNIQUE(");
-                                                       sbIx2Cnts.append("ALTER TABLE " + strSplit[0] + " DROP UNIQUE(");
+                                                       sbIxCnts.append("ALTER TABLE " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted + " ADD CONSTRAINT " + cp.sqlQuoted + strSplit[1] + cp.sqlQuoted + " UNIQUE(");
+                                                       sbIx2Cnts.append("ALTER TABLE " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted + " DROP UNIQUE(");
                                                } else if (strSplit[3].equals("")){
-                                                       sbIxCnts.append("CREATE INDEX " + strSplit[1] + " ON " + strSplit[0] + "(");
+                                                       sbIxCnts.append("CREATE INDEX " + cp.sqlQuoted + strSplit[1] + cp.sqlQuoted + " ON " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted + "(");
                                                }
-                                               sbIx3Cnts.append("DROP INDEX " + strSplit[1] + ";");
+                                               sbIx3Cnts.append("DROP INDEX " + cp.sqlQuoted + strSplit[1] + cp.sqlQuoted + ";");
                                        }
                                        for(int i=0;i<strSplit.length;i++)CmnUtils.debugPrint("'" + strSplit[i] + "'");
 
@@ -616,11 +580,11 @@ public class RapideMetaUnloader{
                        if (!indexName.equals("")){
                                //Post Process
                                if (colPos.equals("1")){
-                                       sbIxCnts.append(colName);
-                                       if (constraintType.equals("U"))sbIx2Cnts.append(colName);
+                                       sbIxCnts.append(cp.sqlQuoted + colName + cp.sqlQuoted);
+                                       if (constraintType.equals("U"))sbIx2Cnts.append(cp.sqlQuoted + colName + cp.sqlQuoted);
                                } else {
-                                       sbIxCnts.append(", " + colName);
-                                       if (constraintType.equals("U"))sbIx2Cnts.append(", " + colName);
+                                       sbIxCnts.append(", " + cp.sqlQuoted + colName + cp.sqlQuoted);
+                                       if (constraintType.equals("U"))sbIx2Cnts.append(", " + cp.sqlQuoted + colName + cp.sqlQuoted);
                                }
                                sbIxCnts.append(");");
                                sbIxCnts.append(cp.lineSeparator);
@@ -658,8 +622,8 @@ public class RapideMetaUnloader{
                        br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_VIEW] + "_" + database +".csv"));
                        subFolder = new File(folder + "/VIEWS");
                        subFolder.mkdir();
-                       pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "createView.sql"))));
-                       pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "dropView.sql"))));
+                       pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_VIEW]))));
+                       pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_VIEW]))));
                        while((strLine=br[0].readLine()) != null){
                                strSplit = CmnUtils.splitCsv(strLine);
                                CmnUtils.debugPrint("'" + strSplit[0] + "'");
@@ -702,10 +666,10 @@ public class RapideMetaUnloader{
                                strSplit2 = CmnUtils.splitCrLf(strContents);
                                for(int i=0;i<strSplit2.length;i++)if(!strSplit2[i].trim().equals(""))pw[0].println(strSplit2[i]);
                                pw[0].println(";");
-                               if (!strSplit[1].equals(""))pw[0].println("COMMENT ON TABLE " + strSplit[0] + " IS '" + strSplit[1] + "';");
+                               if (!strSplit[1].equals(""))pw[0].println("COMMENT ON TABLE " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted + " IS '" + strSplit[1] + "';");
                                for(int i=0;i<alData.size();i++){
                                        if ((i+1) % columnCount == 0){
-                                               if (!alData.get(i).equals(""))pw[0].println("COMMENT ON COLUMN " + strSplit[0] + "." + alData.get(i-1) + " IS '" + alData.get(i) + "';");
+                                               if (!alData.get(i).equals(""))pw[0].println("COMMENT ON COLUMN " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted + "." + alData.get(i-1) + " IS '" + alData.get(i) + "';");
                                        }
                                }
                                pw[0].close();
@@ -721,8 +685,8 @@ public class RapideMetaUnloader{
                        br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_PROCEDURE] + "_" + database +".csv"));
                        subFolder = new File(folder + "/PROCEDURES");
                        subFolder.mkdir();
-                       pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "createProcedure.sql"))));
-                       pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "dropProcedure.sql"))));
+                       pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PROCEDURE]))));
+                       pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_PROCEDURE]))));
                        while((strLine=br[0].readLine()) != null){
                                strSplit = CmnUtils.splitCsv(strLine);
                                CmnUtils.debugPrint("'" + strSplit[0] + "'");
@@ -752,8 +716,8 @@ public class RapideMetaUnloader{
 
                        // Sequence Contents start
                        br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_SEQ] + "_" + database +".csv"));
-                       pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "createSequence.sql"))));
-                       pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "dropSequence.sql"))));
+                       pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_SEQUENCE]))));
+                       pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_SEQUENCE]))));
 
                        while((strLine=br[0].readLine()) != null){
                                strSplit = CmnUtils.splitCsv(strLine);
@@ -765,7 +729,7 @@ public class RapideMetaUnloader{
                                odFg = strSplit[5];
                                cacheSz = strSplit[6];
                                lstNo = strSplit[7];
-                               pw[1].print("CREATE SEQUENCE \"" + seqName + "\" MINVALUE " + minVal + " MAXVALUE " + maxVal + " INCREMENT BY " + incSz + " START WITH " + lstNo + " CACHE " + cacheSz);
+                               pw[1].print("CREATE SEQUENCE \"" + cp.sqlQuoted + seqName + cp.sqlQuoted + "\" MINVALUE " + minVal + " MAXVALUE " + maxVal + " INCREMENT BY " + incSz + " START WITH " + lstNo + " CACHE " + cacheSz);
                                if (odFg.equals("N")){
                                        pw[1].print(" NOORDER");
                                } else {
@@ -777,7 +741,7 @@ public class RapideMetaUnloader{
                                        pw[1].print(" CYCLE");
                                }
                                pw[1].println(";");
-                               pw[2].println("DROP SEQUENCE \"" + seqName + "\";");
+                               pw[2].println("DROP SEQUENCE \"" + cp.sqlQuoted + seqName + cp.sqlQuoted + "\";");
                                for(int i=0;i<strSplit.length;i++)CmnUtils.debugPrint("'" + strSplit[i] + "'");
                        }
                        for(int i=1;i<3;i++)pw[i].close();
@@ -788,25 +752,24 @@ public class RapideMetaUnloader{
 
                        // Synonym Contents start
                        br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_SYNONYM] + "_" + database +".csv"));
-                       pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "createSynonym.sql"))));
-                       pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "dropSynonym.sql"))));
+                       pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_SYNONYM]))));
+                       pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_SYNONYM]))));
 
                        while((strLine=br[0].readLine()) != null){
                                strSplit = CmnUtils.splitCsv(strLine);
-                               synmOwner = strSplit[0];
-                               synmName = strSplit[1];
-                               tbOwner = strSplit[2];
-                               tbName = strSplit[3];
-                               dbLnk = strSplit[4];
+                               synmName = strSplit[0];
+                               tbOwner = strSplit[1];
+                               tbName = strSplit[2];
+                               dbLnk = strSplit[3];
                                
-                               pw[1].print("CREATE SYNONYM \"" + synmOwner + "\"." + "\"" + synmName + "\" FOR ");
+                               pw[1].print("CREATE SYNONYM " + cp.sqlQuoted + synmName + cp.sqlQuoted + " FOR ");
                                if(dbLnk.equals("")){
-                                       pw[1].print(tbOwner + "." + tbName);
+                                       pw[1].print(cp.sqlQuoted + tbOwner + cp.sqlQuoted + "." + cp.sqlQuoted + tbName + cp.sqlQuoted );
                                } else {
-                                       pw[1].print(tbName + "@" + dbLnk);
+                                       pw[1].print(cp.sqlQuoted + tbName + cp.sqlQuoted + "@" + cp.sqlQuoted + dbLnk + cp.sqlQuoted );
                                }
                                pw[1].println(";");
-                               pw[2].println("DROP SYNONYM \"" + synmOwner + "\"." + "\"" + synmName + "\";");
+                               pw[2].println("DROP SYNONYM " + cp.sqlQuoted + synmName + cp.sqlQuoted + ";");
                                for(int i=0;i<strSplit.length;i++)CmnUtils.debugPrint("'" + strSplit[i] + "'");
                        }
                        for(int i=1;i<3;i++)pw[i].close();
@@ -815,103 +778,73 @@ public class RapideMetaUnloader{
                        br[0] = null;
                        // Synonym Contents end
 
-                       // DBlink Contents start
-                       br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_DBLINK] + "_" + database +".csv"));
-                       pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "createDBLinks.sql"))));
-                       pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "dropDBLinks.sql"))));
-
-                       while((strLine=br[0].readLine()) != null){
-                               strSplit = CmnUtils.splitCsv(strLine);
-                               dbLnk = strSplit[0];
-                               userName = strSplit[1];
-                               passWord = strSplit[2];
-                               host = strSplit[3];
-                               created = strSplit[4];
-                               if(passWord.equals(""))passWord = userName;
-                               pw[1].println("CREATE DATABASE LINK " + dbLnk + " CONNECT TO " + passWord + " IDENTIFIED BY " + userName + " USING '" + host + "';");
-                               pw[2].println("DROP DATABASE LINK " + dbLnk + ";");
-                               for(int i=0;i<strSplit.length;i++)CmnUtils.debugPrint("'" + strSplit[i] + "'");
-                       }
-                       for(int i=1;i<3;i++)pw[i].close();
-                       for(int i=1;i<3;i++)pw[i]=null;
-                       br[0].close();
-                       br[0] = null;
-                       // DBlink Contents end
-
-                       // objPrivs Contents start
-                       br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_OBJPRIVS] + "_" + database +".csv"));
-                       pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "grantObjPrivs.sql"))));
-                       pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "revokeObjPrivs.sql"))));
-
-                       while((strLine=br[0].readLine()) != null){
-                               strSplit = CmnUtils.splitCsv(strLine);
-                               grntee = strSplit[0];
-                               tbOwner = strSplit[1];
-                               tbName = strSplit[2];
-                               grntor = strSplit[3];
-                               prvs = strSplit[4];
-                               grntabl = strSplit[5];
-                               hrchy = strSplit[6];
-                               pw[1].println("GRANT " + prvs + " ON " + tbOwner + "." + tbName + " TO " + grntee + ";");
-                               pw[2].println("REVOKE " + prvs + " ON " + tbOwner + "." + tbName + " FROM " + grntee + ";");
-                               for(int i=0;i<strSplit.length;i++)CmnUtils.debugPrint("'" + strSplit[i] + "'");
-                       }
-                       for(int i=1;i<3;i++)pw[i].close();
-                       for(int i=1;i<3;i++)pw[i]=null;
-                       br[0].close();
-                       br[0] = null;
-                       // objPrivs Contents end
-
-                       // sysPrivs Contents start
-                       br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_SYSPRIVS] + "_" + database +".csv"));
-                       pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "grantSysPrivs.sql"))));
-                       pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "revokeSysPrivs.sql"))));
-
-                       while((strLine=br[0].readLine()) != null){
-                               strSplit = CmnUtils.splitCsv(strLine);
-                               grntee = strSplit[0];
-                               prvs = strSplit[1];
-                               pw[1].println("GRANT " + prvs + " TO " + grntee + ";");
-                               pw[2].println("REVOKE " + prvs + " FROM " + grntee + ";");
-                               for(int i=0;i<strSplit.length;i++)CmnUtils.debugPrint("'" + strSplit[i] + "'");
-                       }
-                       pw[1].close();
-                       pw[1] = null;
-                       pw[2].close();
-                       pw[2] = null;
-                       br[0].close();
-                       br[0] = null;
-                       // sysPrivs Contents end
-
-                       // RolePrivs Contents start
-                       br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_ROLEPRIVS] + "_" + database +".csv"));
-                       pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "grantRolePrivs.sql"))));
-                       pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "revokeRolePrivs.sql"))));
-
-                       while((strLine=br[0].readLine()) != null){
-                               strSplit = CmnUtils.splitCsv(strLine);
-                               grntee = strSplit[0];
-                               grntrl = strSplit[1];
-                               pw[1].println("GRANT " + grntrl + " TO " + grntee + ";");
-                               pw[2].println("REVOKE " + grntrl + " FROM " + grntee + ";");
-                               for(int i=0;i<strSplit.length;i++)CmnUtils.debugPrint("'" + strSplit[i] + "'");
+                       // Fk Contents start
+                       File csvFile = new File(folder + "/" + FILE_NAME[FL_FK] + "_" + database +".csv");
+                       if (csvFile.length() > 0) {
+                               br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_FK] + "_" + database +".csv"));
+                               pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_FK]))));
+                               pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.DROP_FK]))));
+                               tbName = "";
+                               fkName = "";
+                               fkCol = "";
+                               fkColPos = "";
+                               rtbName = "";
+                               rfkName = "";
+                               rfkCol = "";
+                               rfkColPos = "";
+                               
+                               while((strLine=br[0].readLine()) != null){
+                                       strSplit = CmnUtils.splitCsv(strLine);
+                                       if(!fkName.equals(strSplit[1]) && !fkName.equals("")){
+                                               pw[1].println("ALTER TABLE " + cp.sqlQuoted + tbName + cp.sqlQuoted + " ADD CONSTRAINT " + cp.sqlQuoted + fkName + " FOREIGN KEY (" + cp.sqlQuoted + fkCol + cp.sqlQuoted + ") REFERENCES " + cp.sqlQuoted + rtbName + cp.sqlQuoted + " (" + cp.sqlQuoted + rfkCol + cp.sqlQuoted + ");");
+                                               pw[2].println("ALTER TABLE " + cp.sqlQuoted + tbName + cp.sqlQuoted + " DROP CONSTRAINT " + cp.sqlQuoted + fkName + ";");
+                                               for(int i=0;i<strSplit.length;i++)CmnUtils.debugPrint("'" + strSplit[i] + "'");
+                                               tbName = strSplit[0];
+                                               fkName = strSplit[1];
+                                               fkCol = strSplit[2];
+                                               fkColPos = strSplit[3];
+                                               rtbName = strSplit[4];
+                                               rfkName = strSplit[5];
+                                               rfkCol = strSplit[6];
+                                               rfkColPos = strSplit[7];
+                                       } else {
+                                               if(fkName.equals("")){
+                                                       tbName = strSplit[0];
+                                                       fkName = strSplit[1];
+                                                       fkCol = strSplit[2];
+                                                       fkColPos = strSplit[3];
+                                                       rtbName = strSplit[4];
+                                                       rfkName = strSplit[5];
+                                                       rfkCol = strSplit[6];
+                                                       rfkColPos = strSplit[7];
+                                               } else {
+                                                       if (strSplit[3].equals(strSplit[7])) {
+                                                               fkCol = fkCol + cp.sqlQuoted + ", " + cp.sqlQuoted + strSplit[2] + cp.sqlQuoted;
+                                                               rfkCol = rfkCol + ", " + cp.sqlQuoted + strSplit[6] + cp.sqlQuoted;
+                                                       }
+                                               }
+                                       }
+                                       
+                               }
+                               pw[1].println("ALTER TABLE " + cp.sqlQuoted + tbName + cp.sqlQuoted + " ADD CONSTRAINT " + cp.sqlQuoted + fkName + cp.sqlQuoted + " FOREIGN KEY (" + cp.sqlQuoted + fkCol + cp.sqlQuoted + ") REFERENCES " + cp.sqlQuoted + rtbName + cp.sqlQuoted + " (" + cp.sqlQuoted + rfkCol + cp.sqlQuoted + ");");
+                               pw[2].println("ALTER TABLE " + cp.sqlQuoted + cp.sqlQuoted + tbName + cp.sqlQuoted + " DROP CONSTRAINT " + cp.sqlQuoted + fkName + cp.sqlQuoted + ";");
+                               for(int i=1;i<3;i++)pw[i].close();
+                               for(int i=1;i<3;i++)pw[i]=null;
+                               br[0].close();
+                               br[0] = null;
                        }
-                       for(int i=1;i<3;i++)pw[i].close();
-                       for(int i=1;i<3;i++)pw[i]=null;
-                       br[0].close();
-                       br[0] = null;
-                       // RolePrivs Contents end
+                       // Fk Contents end
 
                        // Rhysical Contents start
                        if(cp.isPhysical){
                                // physical index setting
                                br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_OBJ] + "_" + database +".csv"));
-                               br[1] = new BufferedReader(new FileReader(folder + "/" + "createPrimaryKey.sql"));
-                               br[2] = new BufferedReader(new FileReader(folder + "/" + "createUniqueKey.sql"));
-                               br[3] = new BufferedReader(new FileReader(folder + "/" + "createIndex.sql"));
-                               pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "createPrimaryKey.sql.phy"))));
-                               pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "createUniqueKey.sql.phy"))));
-                               pw[3] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "createIndex.sql.phy"))));
+                               br[1] = new BufferedReader(new FileReader(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY]));
+                               br[2] = new BufferedReader(new FileReader(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY]));
+                               br[3] = new BufferedReader(new FileReader(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX]));
+                               pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY] + ".phy"))));
+                               pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY] + ".phy"))));
+                               pw[3] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX] + ".phy"))));
                                alData = new ArrayList<String>();
                                int rowNo;
                                String [] rowData;
@@ -921,7 +854,7 @@ public class RapideMetaUnloader{
                                }
                                while((strLine=br[1].readLine()) != null){
                                        strSplit = CmnUtils.splitSpace(strLine);
-                                       rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[5]);
+                                       rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[5].replaceAll(cp.sqlQuoted,""));
                                        if (rowNo != -1){
                                                rowData = rowData = CmnUtils.getArrayRowData(alData, 12, rowNo);
                                                CmnUtils.debugPrint(strSplit[5] + ":" + rowNo);
@@ -944,7 +877,7 @@ public class RapideMetaUnloader{
                                                if(!freeLst.equals(""))pw[1].print(" FREELISTS " + freeLst);
                                                if(!flstGrp.equals(""))pw[1].print(" FREELIST GROUPS " + flstGrp);
                                                pw[1].print(" BUFFER_POOL " + bufPool + ")");
-                                               pw[1].print(" TABLESPACE " + "\"" + tblSpace + "\"");
+                                               pw[1].print(" TABLESPACE " + cp.sqlQuoted + tblSpace + cp.sqlQuoted);
                                                if(logging.equals("NO")){
                                                        pw[1].println(" NOLOGGING;");
                                                } else {
@@ -957,7 +890,7 @@ public class RapideMetaUnloader{
                                }
                                while((strLine=br[2].readLine()) != null){
                                        strSplit = CmnUtils.splitSpace(strLine);
-                                       rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[5]);
+                                       rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[5].replaceAll(cp.sqlQuoted,""));
                                        if (rowNo != -1){
                                                rowData = rowData = CmnUtils.getArrayRowData(alData, 12, rowNo);
                                                CmnUtils.debugPrint(strSplit[5] + ":" + rowNo);
@@ -980,7 +913,7 @@ public class RapideMetaUnloader{
                                                if(!freeLst.equals(""))pw[2].print(" FREELISTS " + freeLst);
                                                if(!flstGrp.equals(""))pw[2].print(" FREELIST GROUPS " + flstGrp);
                                                pw[2].print(" BUFFER_POOL " + bufPool + ")");
-                                               pw[2].print(" TABLESPACE " + "\"" + tblSpace + "\"");
+                                               pw[2].print(" TABLESPACE " + cp.sqlQuoted + tblSpace + cp.sqlQuoted);
                                                if(logging.equals("NO")){
                                                        pw[2].println(" NOLOGGING;");
                                                } else {
@@ -993,10 +926,10 @@ public class RapideMetaUnloader{
                                }
                                while((strLine=br[3].readLine()) != null){
                                        strSplit = CmnUtils.splitSpace(strLine);
-                                       rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[2]);
+                                       rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[2].replaceAll(cp.sqlQuoted,""));
+                                       CmnUtils.debugPrint("rowNo=" + rowNo);
                                        if (rowNo != -1){
                                                rowData = CmnUtils.getArrayRowData(alData, 12, rowNo);
-                                               CmnUtils.debugPrint(strSplit[2] + ":" + rowNo);
                                                for(int i=0;i<rowData.length;i++)CmnUtils.debugPrint(rowData[i]);
                                                tbName = rowData[0];
                                                objName = rowData[1];
@@ -1016,7 +949,7 @@ public class RapideMetaUnloader{
                                                if(!freeLst.equals(""))pw[3].print(" FREELISTS " + freeLst);
                                                if(!flstGrp.equals(""))pw[3].print(" FREELIST GROUPS " + flstGrp);
                                                pw[3].print(" BUFFER_POOL " + bufPool + ")");
-                                               pw[3].print(" TABLESPACE " + "\"" + tblSpace + "\"");
+                                               pw[3].print(" TABLESPACE " + cp.sqlQuoted + tblSpace + cp.sqlQuoted);
                                                if(logging.equals("NO")){
                                                        pw[3].println(" NOLOGGING;");
                                                } else {
@@ -1035,12 +968,12 @@ public class RapideMetaUnloader{
                                File [] fmFl = new File[6];
                                File [] toFl = new File[6];
                                
-                               fmFl[0] = new File(folder + "/" + "createPrimaryKey.sql.phy");
-                               fmFl[1] = new File(folder + "/" + "createUniqueKey.sql.phy");
-                               fmFl[2] = new File(folder + "/" + "createIndex.sql.phy");
-                               toFl[0] = new File(folder + "/" + "createPrimaryKey.sql");
-                               toFl[1] = new File(folder + "/" + "createUniqueKey.sql");
-                               toFl[2] = new File(folder + "/" + "createIndex.sql");
+                               fmFl[0] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY] + ".phy");
+                               fmFl[1] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY] + ".phy");
+                               fmFl[2] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX] + ".phy");
+                               toFl[0] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY]);
+                               toFl[1] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY]);
+                               toFl[2] = new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX]);
                                for(int i=0;i<3;i++){
                                        CmnUtils.debugPrint(fmFl[i].toString() + ">" + toFl[i].toString());
                                        toFl[i].delete();
@@ -1084,7 +1017,7 @@ public class RapideMetaUnloader{
                                                                if(!freeLst.equals(""))pw[0].print(" FREELISTS " + freeLst);
                                                                if(!flstGrp.equals(""))pw[0].print(" FREELIST GROUPS " + flstGrp);
                                                                pw[0].print(" BUFFER_POOL " + bufPool + ")");
-                                                               pw[0].print(" TABLESPACE " + "\"" + tblSpace + "\"");
+                                                               pw[0].print(" TABLESPACE " + cp.sqlQuoted + tblSpace + cp.sqlQuoted);
                                                                if(logging.equals("NO")){
                                                                        pw[0].println(" NOLOGGING;");
                                                                } else {
@@ -1107,69 +1040,6 @@ public class RapideMetaUnloader{
                        }
                        // Rhysical Contents end
 
-                       // Fk Contents start
-                       File csvFile = new File(folder + "/" + FILE_NAME[FL_FK] + "_" + database +".csv");
-                       if (csvFile.length() > 0) {
-                               br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_FK] + "_" + database +".csv"));
-                               pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "createFk.sql"))));
-                               pw[2] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "dropFk.sql"))));
-                               pw[3] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "enableFk.sql"))));
-                               pw[4] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + "disableFk.sql"))));
-                               tbName = "";
-                               fkName = "";
-                               fkCol = "";
-                               fkColPos = "";
-                               rtbName = "";
-                               rfkName = "";
-                               rfkCol = "";
-                               rfkColPos = "";
-                               
-                               while((strLine=br[0].readLine()) != null){
-                                       strSplit = CmnUtils.splitCsv(strLine);
-                                       if(!fkName.equals(strSplit[1]) && !fkName.equals("")){
-                                               pw[1].println("ALTER TABLE \"" + tbName + "\" ADD CONSTRAINT \"" + fkName + "\" FOREIGN KEY (\"" + fkCol + "\") REFERENCES \"" + rtbName + "\" (\"" + rfkCol + "\");");
-                                               pw[2].println("ALTER TABLE \"" + tbName + "\" DROP CONSTRAINT \"" + fkName + "\";");
-                                               pw[3].println("ALTER TABLE \"" + tbName + "\" ENABLE CONSTRAINT \"" + fkName + "\";");
-                                               pw[4].println("ALTER TABLE \"" + tbName + "\" DISABLE CONSTRAINT \"" + fkName + "\";");
-                                               for(int i=0;i<strSplit.length;i++)CmnUtils.debugPrint("'" + strSplit[i] + "'");
-                                               tbName = strSplit[0];
-                                               fkName = strSplit[1];
-                                               fkCol = strSplit[2];
-                                               fkColPos = strSplit[3];
-                                               rtbName = strSplit[4];
-                                               rfkName = strSplit[5];
-                                               rfkCol = strSplit[6];
-                                               rfkColPos = strSplit[7];
-                                       } else {
-                                               if(fkName.equals("")){
-                                                       tbName = strSplit[0];
-                                                       fkName = strSplit[1];
-                                                       fkCol = strSplit[2];
-                                                       fkColPos = strSplit[3];
-                                                       rtbName = strSplit[4];
-                                                       rfkName = strSplit[5];
-                                                       rfkCol = strSplit[6];
-                                                       rfkColPos = strSplit[7];
-                                               } else {
-                                                       if (strSplit[3].equals(strSplit[7])) {
-                                                               fkCol = fkCol + "\", \"" + strSplit[2];
-                                                               rfkCol = rfkCol + "\", \"" + strSplit[6];
-                                                       }
-                                               }
-                                       }
-                                       
-                               }
-                               pw[1].println("ALTER TABLE \"" + tbName + "\" ADD CONSTRAINT \"" + fkName + "\" FOREIGN KEY (\"" + fkCol + "\") REFERENCES \"" + rtbName + "\" (\"" + rfkCol + "\");");
-                               pw[2].println("ALTER TABLE \"" + tbName + "\" DROP CONSTRAINT \"" + fkName + "\";");
-                               pw[3].println("ALTER TABLE \"" + tbName + "\" ENABLE CONSTRAINT \"" + fkName + "\";");
-                               pw[4].println("ALTER TABLE \"" + tbName + "\" DISABLE CONSTRAINT \"" + fkName + "\";");
-                               for(int i=1;i<5;i++)pw[i].close();
-                               for(int i=1;i<5;i++)pw[i]=null;
-                               br[0].close();
-                               br[0] = null;
-                       }
-                       // Fk Contents end
-
                        // Remove work file
                        File fl= null;
                        for(int i=0;i<sql.length;i++){