OSDN Git Service

20170423
authorkuboryu <kuboryu@yahoo.co.jp>
Sun, 23 Apr 2017 09:12:38 +0000 (18:12 +0900)
committerkuboryu <kuboryu@yahoo.co.jp>
Sun, 23 Apr 2017 09:12:38 +0000 (18:12 +0900)
com/rapide_act/CmnProperty.java
com/rapide_act/DataAccessObjects.java
com/rapide_act/RapideMetaLoader.java [new file with mode: 0644]
com/rapide_act/RapideMetaUnloader.java
rapide-act-1.0_src.zip [new file with mode: 0644]
rapide-act-1.1_src.zip [new file with mode: 0644]

index e65d878..7cab140 100644 (file)
@@ -71,16 +71,60 @@ public class CmnProperty{
        protected static final int D_FILEEXT = 27;
        protected static final int D_SQLQUOTED = 28;
        protected static final int D_PHYSICAL = 29;
-       protected static final int KEYS = 30;
+       protected static final int D_DROP = 30;
+       protected static final int KEYS = 31;
        protected static final String [] PROP_KEY = { "us","pw","url","dr","out","in","ls","ils","fe","nm",
                                                                                                  "dm","ts","tks","od","qt","bc","it","et","ic","ec",
-                                                                                                 "icm","ecm","smc","dmc","mp","pf","sp","ext","sq", "ph"};
+                                                                                                 "icm","ecm","smc","dmc","mp","pf","sp","ext","sq", "ph", "dp"};
 
        protected String [] prop_val = new String[KEYS];
        protected static final String [] MASK_PTN = {"ALL", "ALT", "EDGE"};
        protected static final String DEFAULT_IN_FOLDER = "input";
        protected static final String DEFAULT_OUT_FOLDER = "output";
        protected static final String DEFAULT_PROP_FILE = "RapideAct.properties";
+
+       protected static final int CREATE_TABLE = 0;
+       protected static final int DROP_TABLE = 1;
+       protected static final int TRUNCATE_TABLE = 2;
+       protected static final int CREATE_PKEY = 3;
+       protected static final int DROP_PKEY = 4;
+       protected static final int CREATE_UKEY = 5;
+       protected static final int DROP_UKEY = 6;
+       protected static final int CREATE_INDEX = 7;
+       protected static final int DROP_INDEX = 8;
+       protected static final int CREATE_VIEW = 9;
+       protected static final int DROP_VIEW = 10;
+       protected static final int CREATE_PROCEDURE = 11;
+       protected static final int DROP_PROCEDURE = 12;
+       protected static final int CREATE_SYNONYM = 13;
+       protected static final int DROP_SYNONYM = 14;
+       protected static final int CREATE_SEQUENCE = 15;
+       protected static final int DROP_SEQUENCE = 16;
+       protected static final int CREATE_FK = 17;
+       protected static final int DROP_FK = 18;
+       
+       protected static final String [] SQL_FILE_NAME = {
+               "createTable.sql",
+               "dropTable.sql",
+               "truncateTable.sql",
+               "createPrimaryKey.sql",
+               "dropPrimaryKey.sql",
+               "createUniqueKey.sql",
+               "dropUniqueKey.sql",
+               "createIndex.sql",
+               "dropIndex.sql",
+               "createView.sql",
+               "dropView.sql",
+               "createProcedure.sql",
+               "dropProcedure.sql",
+               "createSynonym.sql",
+               "dropSynonym.sql",
+               "createSequence.sql",
+               "dropSequence.sql",
+               "createFk.sql",
+               "dropFk.sql"
+       };
+       
        protected static final String [] T_SQL_ARRAY = {
                "select "
                + " table_name "
@@ -287,6 +331,7 @@ public class CmnProperty{
        protected boolean isOrder                               = false;
        protected boolean isQuotation                   = true;
        protected boolean isPhysical                    = false;
+       protected boolean isDrop                                = false;
        protected int batchCount                                = 1000;
        protected String inclTables                     = null;
        protected String exclTables                     = null;
@@ -379,6 +424,7 @@ public class CmnProperty{
                if(!CmnUtils.isEmpty(prop_val[D_ORDER]) && prop_val[D_ORDER].toUpperCase().equals("Y"))isOrder = true;
                if(!CmnUtils.isEmpty(prop_val[D_QUOTATION]) && prop_val[D_QUOTATION].toUpperCase().equals("N"))isQuotation = false;
                if(!CmnUtils.isEmpty(prop_val[D_PHYSICAL]) && prop_val[D_PHYSICAL].toUpperCase().equals("Y"))isPhysical = true;
+               if(!CmnUtils.isEmpty(prop_val[D_DROP]) && prop_val[D_DROP].toUpperCase().equals("Y"))isDrop = true;
                if(!CmnUtils.isEmpty(prop_val[D_BATCOUNT]) && CmnUtils.isNumeric(prop_val[D_BATCOUNT]))batchCount = Integer.parseInt(prop_val[D_BATCOUNT]);
                if(!CmnUtils.isEmpty(prop_val[D_INCLTAB]))isInclTables = true;
                if(!CmnUtils.isEmpty(prop_val[D_EXCLTAB]))isExclTables = true;
index 5d6f71e..d3e8168 100644 (file)
@@ -87,7 +87,7 @@ public class DataAccessObjects{
                driver = cp.driver;
        }
 
-       public Connection connect() throws Exception{
+       protected Connection connect() throws Exception{
 
                try {
                        CmnUtils.debugPrint("Start Driver class loading");
@@ -110,7 +110,7 @@ public class DataAccessObjects{
                }
        }
 
-       public PreparedStatement prepareSql(String _sql) throws Exception{
+       protected PreparedStatement prepareSql(String _sql) throws Exception{
                try {
                        CmnUtils.debugPrint("Start prepared Statement");
                        CmnUtils.debugPrint(_sql);
@@ -126,7 +126,7 @@ public class DataAccessObjects{
                }
        }
 
-       public void executeSql() throws Exception{
+       protected void executeSql() throws Exception{
 
                try {
                        executeSql(stmt);
@@ -161,7 +161,7 @@ public class DataAccessObjects{
                }
        }
 
-       public void executeSql(PreparedStatement _stmt) throws Exception{
+       protected void executeSql(PreparedStatement _stmt) throws Exception{
 
                try {
                        CmnUtils.debugPrint("Start execute Query");
@@ -200,19 +200,19 @@ public class DataAccessObjects{
                }
        }
 
-       public void commit() throws Exception{
+       protected void commit() throws Exception{
                CmnUtils.debugPrint("Start commit");
                conn.commit();
                CmnUtils.debugPrint("End commit");
        }
 
-       public void rollback() throws Exception{
+       protected void rollback() throws Exception{
                CmnUtils.debugPrint("Start rollback");
                conn.rollback();
                CmnUtils.debugPrint("End rollback");
        }
        
-       public void closeRecordSet() throws Exception{
+       protected void closeRecordSet() throws Exception{
                if(rst != null){
                        rst.close();
                        rst = null;
@@ -223,7 +223,7 @@ public class DataAccessObjects{
                }
        }
 
-       public void select(String _sql) throws Exception{
+       protected void select(String _sql) throws Exception{
                PreparedStatement stmt;
                stmt = prepareSql(_sql);
                executeSql(stmt);
@@ -231,53 +231,53 @@ public class DataAccessObjects{
                closeRecordSet();
        }
 
-       public int getColumnCount() throws Exception{
+       protected int getColumnCount() throws Exception{
                return ColumnCount;
        }
 
-       public int getRecCount() throws Exception{
+       protected int getRecCount() throws Exception{
                return recCount;
        }
 
-       public ArrayList<String> getArrayList() throws Exception{
+       protected ArrayList<String> getArrayList() throws Exception{
                return alData;
        }
 
-       public ArrayList<String> getArrayColumnNameList() throws Exception{
+       protected ArrayList<String> getArrayColumnNameList() throws Exception{
                return alColName;
        }
        
-       public ArrayList<String> getArrayColumnTypeNameList() throws Exception{
+       protected ArrayList<String> getArrayColumnTypeNameList() throws Exception{
                return alColTypeName;
        }
 
-       public ArrayList<Integer> getArrayIsNullableList() throws Exception{
+       protected ArrayList<Integer> getArrayIsNullableList() throws Exception{
                return alIsNullable;
        }
 
-       public ArrayList<Integer> getArrayPrecisionList() throws Exception{
+       protected ArrayList<Integer> getArrayPrecisionList() throws Exception{
                return alColPrecision;
        }
 
-       public void setArrayColumnMaskList(ArrayList<Boolean> _alColMask) throws Exception{
+       protected void setArrayColumnMaskList(ArrayList<Boolean> _alColMask) throws Exception{
                alColMask = _alColMask;
                colMask = (Boolean[])alColMask.toArray(new Boolean[0]);
        }
 
-       public void setArrayColumnInclList(ArrayList<Boolean> _alColIncl) throws Exception{
+       protected void setArrayColumnInclList(ArrayList<Boolean> _alColIncl) throws Exception{
                alColIncl = _alColIncl;
                colIncl = (Boolean[])alColIncl.toArray(new Boolean[0]);
        }
 
-       public void setTableName(String _tbName) throws Exception{
+       protected void setTableName(String _tbName) throws Exception{
                tbName = _tbName;
        }
 
-       public ResultSet getResultSet() throws Exception{
+       protected ResultSet getResultSet() throws Exception{
                return rst;
        }
 
-       public void getRecordToArray() throws Exception{
+       protected void getRecordToArray() throws Exception{
                try {
                        CmnUtils.debugPrint("Start get RecordSet to Array");
                        while (rst.next()) {
@@ -302,7 +302,7 @@ public class DataAccessObjects{
                }
        }
        
-       public void getRecordToPrint(PrintWriter _pw, int _firstCol, int _lastCol) throws Exception{
+       protected void getRecordToPrint(PrintWriter _pw, int _firstCol, int _lastCol) throws Exception{
                try {
                        CmnUtils.debugPrint("Start get Record to Print");
                        recCount = 0;
@@ -668,7 +668,7 @@ public class DataAccessObjects{
                }
        }
 
-       public void disconnect() throws Exception{
+       protected void disconnect() throws Exception{
 
                try {
                        CmnUtils.debugPrint("Start disconnect database");
diff --git a/com/rapide_act/RapideMetaLoader.java b/com/rapide_act/RapideMetaLoader.java
new file mode 100644 (file)
index 0000000..1163c1b
--- /dev/null
@@ -0,0 +1,205 @@
+package com.rapide_act;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.BufferedWriter;
+import java.io.BufferedReader;
+import java.io.PrintWriter;
+import java.io.PrintWriter;
+import java.util.Date;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Properties;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.PreparedStatement;
+import java.sql.Timestamp;
+import java.sql.Blob;
+import java.sql.Clob;
+
+public class RapideMetaLoader{
+       
+       private String database = null;
+
+       public static void main(String args[]){
+               try {
+                       if (args.length > 0){
+                               RapideMetaLoader RapideMetaLoader = new RapideMetaLoader(args[0]);
+                               RapideMetaLoader.metaLoad();
+                       } else {
+                               RapideMetaLoader RapideMetaLoader = new RapideMetaLoader(null);
+                               RapideMetaLoader.metaLoad();
+                       }
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
+       }
+
+       RapideMetaLoader(String _database) {
+               super();
+               database = _database;
+       }
+
+
+       private void metaLoad(){
+               Connection conn = null;
+               PreparedStatement stmt = null;
+               BufferedReader br = null;
+               File folder = null;
+               File subFolder = null;
+               String strLine = null;
+               String strMltLine = null;
+               String tbName   = null;
+               String viewName         = null;
+               String procName         = null;
+               String [] flName = null;
+               File [] inFiles = null;
+               int tb_count = 0;
+               String [] sqlLine = null;
+
+               CmnProperty cp = null;
+               DataAccessObjects dao = null;
+               
+               try {
+                       cp = new CmnProperty();
+                       cp.setProperty(database);
+                       
+                       if (cp.dbType != cp.DB_TYPE_ORACLE){
+                               throw new Exception("\83f\81[\83^\83x\81[\83X\82ª\91Î\8fÛ\8aO\82Å\82·\81B[" + cp.DB_TYPE_NAME[cp.dbType] + "]");
+                       }
+                       if(cp.inFolder != null){
+                               folder = new File(cp.inFolder);
+                       } else {
+                               if (database != null){
+                                       folder = new File(cp.DEFAULT_IN_FOLDER + "/DDL_" + database.toUpperCase());
+                               } else {
+                                       folder = new File(cp.DEFAULT_IN_FOLDER + "/DDL_" + cp.DB_TYPE_NAME[cp.dbType].toUpperCase());
+                               }
+                       }
+                       CmnUtils.infoPrint("-->\93ü\97Í\8c³\83t\83H\83\8b\83_='" + folder + "'");
+                       CmnUtils.infoPrint("\83\81\83^\83f\81[\83^\83\8d\81[\83h\82ð\8aJ\8en\82µ\82Ü\82µ\82½\81B");
+
+                       // Connect
+                       dao = new DataAccessObjects(cp);
+                       conn = dao.connect();
+
+                       if(cp.isDrop){
+                               executeSqlFile(dao, stmt, folder + "/" + cp.SQL_FILE_NAME[cp.DROP_TABLE], cp, true);
+                               executeSqlFile(dao, stmt, folder + "/" + cp.SQL_FILE_NAME[cp.DROP_VIEW], cp, true);
+                               executeSqlFile(dao, stmt, folder + "/" + cp.SQL_FILE_NAME[cp.DROP_PROCEDURE], cp, true);
+                               executeSqlFile(dao, stmt, folder + "/" + cp.SQL_FILE_NAME[cp.DROP_SYNONYM], cp, true);
+                               executeSqlFile(dao, stmt, folder + "/" + cp.SQL_FILE_NAME[cp.DROP_SEQUENCE], cp, true);
+                               executeSqlFile(dao, stmt, folder + "/" + cp.SQL_FILE_NAME[cp.DROP_FK], cp, true);
+                       }
+                       subFolder = new File(folder + "/TABLES");
+                       inFiles = subFolder.listFiles();
+                       tb_count = 0;
+                       if(inFiles != null) {
+                               for(int k=0;k<inFiles.length;k++){
+                                       flName = CmnUtils.splitDot(inFiles[k].getName());
+                                       tbName = flName[0];
+                                       executeSqlFile(dao, stmt, subFolder + "/" + inFiles[k].getName(), cp, false);
+                               }
+                       }
+                       executeSqlFile(dao, stmt, folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_PKEY], cp, false);
+                       executeSqlFile(dao, stmt, folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_UKEY], cp, false);
+                       executeSqlFile(dao, stmt, folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_INDEX], cp, false);
+                       subFolder = new File(folder + "/VIEWS");
+                       inFiles = subFolder.listFiles();
+                       int view_count = 0;
+                       if(inFiles != null) {
+                               for(int k=0;k<inFiles.length;k++){
+                                       flName = CmnUtils.splitDot(inFiles[k].getName());
+                                       viewName = flName[0];
+                                       executeSqlFile(dao, stmt, subFolder + "/" + inFiles[k].getName(), cp, false);
+                               }
+                       }
+                       subFolder = new File(folder + "/PROCEDURES");
+                       inFiles = subFolder.listFiles();
+                       int proc_count = 0;
+                       if(inFiles != null) {
+                               for(int k=0;k<inFiles.length;k++){
+                                       flName = CmnUtils.splitDot(inFiles[k].getName());
+                                       procName = flName[0];
+                                       executeSqlFile(dao, stmt, subFolder + "/" + inFiles[k].getName(), cp, false);
+                               }
+                       }
+                       executeSqlFile(dao, stmt, folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_SEQUENCE], cp, false);
+                       executeSqlFile(dao, stmt, folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_FK], cp, false);
+
+                       CmnUtils.infoPrint("\83\81\83^\83f\81[\83^\83\8d\81[\83h\82ð\8fI\97¹\82µ\82Ü\82µ\82½\81B");
+
+               } catch(SQLException se) {
+                       try{
+                               CmnUtils.errorPrint(se.toString());
+                               se.printStackTrace();
+                               se = se.getNextException();
+                               if(se != null) {
+                                       System.out.println(se.getMessage());
+                               }
+                               dao.rollback();
+                       } catch (Exception see) {}
+               } catch (Exception e) {                 
+                       try{
+                               CmnUtils.errorPrint(e.toString());
+                               e.printStackTrace();
+                               dao.rollback();
+                       } catch (Exception ee) {}
+               } finally{
+                       try{
+                               dao.disconnect();
+                               if(stmt != null){
+                                       stmt.close();
+                                       stmt=null;
+                               }
+                               if(br!=null){
+                                       br.close();
+                                       br=null;
+                               }
+                       } catch (Exception e) {}
+               }
+       }
+       
+       private void executeSqlFile(DataAccessObjects _dao, PreparedStatement _stmt, String _infile, CmnProperty _cp, boolean _isResume) throws Exception{
+               BufferedReader br = null;
+               String strLine = null;
+               String strMltLine = "";
+               String [] sqlLine = null;
+
+               File infile = new File(_infile);
+               if (infile.exists()){
+                       br = new BufferedReader(new InputStreamReader(new FileInputStream(_infile), _cp.fileEncoding));
+                       while((strLine=br.readLine()) != null){
+                               strMltLine += _cp.inColLineSeparator + strLine;
+                       }
+                       sqlLine = CmnUtils.split(strMltLine, ";");
+                       for(int l = 0;l<sqlLine.length;l++){
+                               if(!sqlLine[l].equals("")){
+                                       try {
+                                               _stmt = _dao.prepareSql(sqlLine[l]);
+                                               _stmt.executeUpdate();
+                                               if(_stmt != null){
+                                                       _stmt.close();
+                                                       _stmt=null;
+                                               }
+                                       } catch (Exception e) {
+                                               if(!_isResume){
+                                                       throw e;
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+
+}
+
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++){
diff --git a/rapide-act-1.0_src.zip b/rapide-act-1.0_src.zip
new file mode 100644 (file)
index 0000000..79108dd
Binary files /dev/null and b/rapide-act-1.0_src.zip differ
diff --git a/rapide-act-1.1_src.zip b/rapide-act-1.1_src.zip
new file mode 100644 (file)
index 0000000..8e14fe5
Binary files /dev/null and b/rapide-act-1.1_src.zip differ