OSDN Git Service

20170503
[rapideact/rapideact.git] / com / rapide_act / RapideMetaUnloader.java
index 6cb24ba..a53cc05 100644 (file)
@@ -15,6 +15,7 @@ import java.util.Date;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.Properties;
+import java.util.regex.Pattern;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.ResultSet;
@@ -45,164 +46,167 @@ public class RapideMetaUnloader{
                "OBJDEF",
                "FKDEF"
        };
-       private static final String [] sql = {
-       "select "
-            + "a.table_name as table_name,"
-            + "replace(replace(b.comments, chr(13), ''), chr(10), '') as table_comments,"
-            + "c.column_name as column_name, "
-            + "replace(replace(d.comments, chr(13), ''), chr(10), '') as column_comments, "
-            + "decode(c.data_type, 'TIMESTAMP(6)', 'TIMESTAMP',c.data_type) as data_type,"
-            + "decode(c.data_type, 'NUMBER', c.data_precision, 'TIMESTAMP(6)', null, c.data_length) as data_length,"
-            + "c.data_scale as data_scale,"
-            + "decode(c.nullable, 'N', '\81\9b', null) as nullable,"
-            + "c.data_default as data_default "
-            + "from user_tables a "
-            + "inner join user_tab_comments b "
-            + "on a.table_name = b.table_name "
-            + "inner join user_tab_columns c "
-            + "on a.table_name = c.table_name "
-            + "inner join user_col_comments d "
-            + "on c.table_name = d.table_name "
-            + " and c.column_name = d.column_name "
-            + "order by a.table_name,c.column_id",
-       "select "
-            + " a.table_name,"
-            + " a.index_name,"
-            + " a.index_type,"
-            + " c.constraint_type,"
-            + " b.column_name,"
-            + " b.column_position "
-            + " from"
-            + " user_indexes a,"
-            + " user_ind_columns b,"
-            + " user_constraints c "
-            + " where"
-            + "  a.table_name = b.table_name and"
-            + "  a.index_name = b.index_name and"
-            + "  a.table_name = c.table_name(+) and"
-            + "  a.index_name = c.constraint_name(+) "
-            + " order by"
-            + " a.table_name,"
-            + " a.index_name,"
-            + " b.column_position",
-       "select "
-            + " a.view_name, "
-            + " replace(replace(c.comments, chr(13), ''), chr(10), '') as comments "
-            + " from"
-            + " user_views a, "
-            + " user_tab_comments c "
-            + " where"
-               + "  a.view_name = c.table_name(+) "
-            + " order by"
-            + " a.view_name",
-       "select "
-            + " object_name, "
-            + " object_type "
-            + "from"
-            + " user_objects"
-            + " where object_type in('PACKAGE','PROCEDURE','FUNCTION','TRIGGER','TYPE')"
-            + " group by object_name,object_type"
-            + " order by object_name,object_type",
-       "select "
-            + "  sequence_name,"
-            + "  to_char(min_value) as min_value,"
-            + "  to_char(max_value) as max_value,"
-            + "  to_char(increment_by) as increment_by,"
-            + "  cycle_flag,"
-            + "  order_flag,"
-            + "  to_char(cache_size) as cache_size,"
-            + "  to_char(last_number) as last_number "
-            + " from user_sequences "
-            + " order by sequence_name",
-       "select "
-            + "  synonym_name,"
-            + "  table_owner,"
-            + "  table_name,"
-            + "  db_link "
-            + "from user_synonyms "
-            + "order by synonym_name,table_owner,table_name",
-       "select "
-            + " a.table_name,"
-            + " a.object_name,"
-            + " a.object_type,"
-            + " a.pct_free,"
-            + " a.pct_used,"
-            + " a.ini_trans,"
-            + " a.freelists,"
-            + " a.freelist_groups,"
-            + " a.buffer_pool,"
-            + " a.tablespace_name, "
-            + " a.logging, "
-            + " b.bytes "
-            + "from "
-            + "(select "
-            + " table_name,"
-            + " table_name as object_name,"
-            + " 'TABLE' as object_type,"
-            + " pct_free,"
-            + " pct_used,"
-            + " ini_trans,"
-            + " freelists,"
-            + " freelist_groups,"
-            + " buffer_pool,"
-            + " tablespace_name, "
-            + " logging "
-            + "from "
-            + " user_tables "
-            + " union select "
-            + " table_name,"
-            + " index_name as object_name,"
-            + " 'INDEX' as object_type,"
-            + " pct_free,"
-            + " null as pct_used,"
-            + " ini_trans,"
-            + " freelists,"
-            + " freelist_groups,"
-            + " buffer_pool,"
-            + " tablespace_name, "
-            + " logging "
-            + " from "
-            + " user_indexes "
-            + ") a, "
-            + "(select "
-            + " segment_name,"
-            + " segment_type,"
-            + " bytes "
-            + " from "
-            + " user_segments "
-            + ") b "
-            + " where a.object_name = b.segment_name "
-            + " and a.object_type = b.segment_type "
-            + " order by"
-            + " a.table_name,"
-            + " a.object_name",
-       "select "
-            + " a.table_name as table_name, "
-            + " a.constraint_name as constraint_name, "
-            + " b.column_name as column_name, "
-            + " b.position as position,"
-            + " c.table_name as r_table_name, "
-            + " c.constraint_name as r_constraint_name, "
-            + " d.column_name as r_column_name, "
-            + " d.position as r_position "
-            + " from "
-            + "   user_constraints a, "
-            + "   user_cons_columns b,"
-            + "   user_constraints c, "
-            + "   user_cons_columns d "
-            + " where "
-            + "   a.constraint_type = 'R'"
-            + "   and a.owner = b.owner"
-            + "   and a.table_name = b.table_name"
-            + "   and a.constraint_name = b.constraint_name"
-            + "   and c.constraint_type in('P','U')"
-            + "   and c.owner = b.owner"
-            + "   and c.table_name = d.table_name"
-            + "   and c.constraint_name = d.constraint_name"
-            + "   and a.r_owner = c.owner"
-            + "   and a.r_constraint_name = c.constraint_name"
-            + " order by"
-            + "   a.table_name,a.constraint_name,b.position,d.position"
+       private static final String [][] sql =  {
+               {
+               "select "
+                    + "a.table_name as table_name,"
+                    + "replace(replace(b.comments, chr(13), ''), chr(10), '') as table_comments,"
+                    + "c.column_name as column_name, "
+                    + "replace(replace(d.comments, chr(13), ''), chr(10), '') as column_comments, "
+                    + "decode(c.data_type, 'TIMESTAMP(6)', 'TIMESTAMP',c.data_type) as data_type, "
+                    + "c.data_length as data_length,"
+                    + "c.data_precision as data_precision,"
+                    + "c.data_scale as data_scale,"
+                    + "decode(c.nullable, 'N', '\81\9b', null) as nullable,"
+                    + "c.data_default as data_default "
+                    + "from user_tables a "
+                    + "inner join user_tab_comments b "
+                    + "on a.table_name = b.table_name "
+                    + "inner join user_tab_columns c "
+                    + "on a.table_name = c.table_name "
+                    + "inner join user_col_comments d "
+                    + "on c.table_name = d.table_name "
+                    + " and c.column_name = d.column_name "
+                    + "order by a.table_name,c.column_id",
+               "select "
+                    + " a.table_name,"
+                    + " a.index_name,"
+                    + " a.index_type,"
+                    + " c.constraint_type,"
+                    + " b.column_name,"
+                    + " b.column_position "
+                    + " from"
+                    + " user_indexes a,"
+                    + " user_ind_columns b,"
+                    + " user_constraints c "
+                    + " where"
+                    + "  a.table_name = b.table_name and"
+                    + "  a.index_name = b.index_name and"
+                    + "  a.table_name = c.table_name(+) and"
+                    + "  a.index_name = c.constraint_name(+) "
+                    + " order by"
+                    + " a.table_name,"
+                    + " a.index_name,"
+                    + " b.column_position",
+               "select "
+                    + " a.view_name, "
+                    + " replace(replace(c.comments, chr(13), ''), chr(10), '') as comments "
+                    + " from"
+                    + " user_views a, "
+                    + " user_tab_comments c "
+                    + " where"
+                       + "  a.view_name = c.table_name(+) "
+                    + " order by"
+                    + " a.view_name",
+               "select "
+                    + " object_name, "
+                    + " object_type "
+                    + "from"
+                    + " user_objects"
+                    + " where object_type in('PACKAGE','PROCEDURE','FUNCTION','TRIGGER','TYPE')"
+                    + " group by object_name,object_type"
+                    + " order by object_name,object_type",
+               "select "
+                    + "  sequence_name,"
+                    + "  to_char(min_value) as min_value,"
+                    + "  to_char(max_value) as max_value,"
+                    + "  to_char(increment_by) as increment_by,"
+                    + "  cycle_flag,"
+                    + "  order_flag,"
+                    + "  to_char(cache_size) as cache_size,"
+                    + "  to_char(last_number) as last_number "
+                    + " from user_sequences "
+                    + " order by sequence_name",
+               "select "
+                    + "  synonym_name,"
+                    + "  table_owner,"
+                    + "  table_name,"
+                    + "  db_link "
+                    + "from user_synonyms "
+                    + "order by synonym_name,table_owner,table_name",
+               "select "
+                    + " a.table_name,"
+                    + " a.object_name,"
+                    + " a.object_type,"
+                    + " a.pct_free,"
+                    + " a.pct_used,"
+                    + " a.ini_trans,"
+                    + " a.freelists,"
+                    + " a.freelist_groups,"
+                    + " a.buffer_pool,"
+                    + " a.tablespace_name, "
+                    + " a.logging, "
+                    + " b.bytes "
+                    + "from "
+                    + "(select "
+                    + " table_name,"
+                    + " table_name as object_name,"
+                    + " 'TABLE' as object_type,"
+                    + " pct_free,"
+                    + " pct_used,"
+                    + " ini_trans,"
+                    + " freelists,"
+                    + " freelist_groups,"
+                    + " buffer_pool,"
+                    + " tablespace_name, "
+                    + " logging "
+                    + "from "
+                    + " user_tables "
+                    + " union select "
+                    + " table_name,"
+                    + " index_name as object_name,"
+                    + " 'INDEX' as object_type,"
+                    + " pct_free,"
+                    + " null as pct_used,"
+                    + " ini_trans,"
+                    + " freelists,"
+                    + " freelist_groups,"
+                    + " buffer_pool,"
+                    + " tablespace_name, "
+                    + " logging "
+                    + " from "
+                    + " user_indexes "
+                    + ") a, "
+                    + "(select "
+                    + " segment_name,"
+                    + " segment_type,"
+                    + " bytes "
+                    + " from "
+                    + " user_segments "
+                    + ") b "
+                    + " where a.object_name = b.segment_name "
+                    + " and a.object_type = b.segment_type "
+                    + " order by"
+                    + " a.table_name,"
+                    + " a.object_name",
+               "select "
+                    + " a.table_name as table_name, "
+                    + " a.constraint_name as constraint_name, "
+                    + " b.column_name as column_name, "
+                    + " b.position as position,"
+                    + " c.table_name as r_table_name, "
+                    + " c.constraint_name as r_constraint_name, "
+                    + " d.column_name as r_column_name, "
+                    + " d.position as r_position "
+                    + " from "
+                    + "   user_constraints a, "
+                    + "   user_cons_columns b,"
+                    + "   user_constraints c, "
+                    + "   user_cons_columns d "
+                    + " where "
+                    + "   a.constraint_type = 'R'"
+                    + "   and a.owner = b.owner"
+                    + "   and a.table_name = b.table_name"
+                    + "   and a.constraint_name = b.constraint_name"
+                    + "   and c.constraint_type in('P','U')"
+                    + "   and c.owner = b.owner"
+                    + "   and c.table_name = d.table_name"
+                    + "   and c.constraint_name = d.constraint_name"
+                    + "   and a.r_owner = c.owner"
+                    + "   and a.r_constraint_name = c.constraint_name"
+                    + " order by"
+                    + "   a.table_name,a.constraint_name,b.position,d.position"
+               }
        };
        private static String sql_view_text = "select text from user_views where view_name = ?";
        private static String sql_view_column_and_comment = "select "
@@ -250,10 +254,7 @@ public class RapideMetaUnloader{
                File subFolder = null;
                String strLine = null;
                String strLine2 = null;
-               String [] strSplit = null;
-               String [] strSplit2 = null;
-               String [] strSplit3 = null;
-               String [] strSplit4 = null;
+               String [][] strSplit = new String[4][];
                String strContents = null;
                ArrayList<String> alData = null;
                ArrayList<String> alData2 = null;
@@ -264,7 +265,8 @@ public class RapideMetaUnloader{
                String colCmnt = null;
                String colType = null;
                String colLen = null;
-               String colDec = null;
+               String colPrec = null;
+               String colScale = null;
                String colNoN = null;
                String colDflt = null;
                String indexName = null;
@@ -345,15 +347,15 @@ public class RapideMetaUnloader{
                        // Connect
                        dao = new DataAccessObjects(cp);
                        conn = dao.connect();
-                       // Def Csv Writing start
-                       for(int i=0;i<sql.length;i++){
-                               dao.select(sql[i]);
-                               CmnUtils.writeCsv(folder + "/" + FILE_NAME[i] + "_" + database +".csv", dao.getColumnCount(), dao.getArrayList());
+                       // Def tsv Writing start
+                       for(int i=0;i<sql[cp.dbType].length;i++){
+                               dao.select(sql[cp.dbType][i]);
+                               CmnUtils.writeSeparator(folder + "/" + FILE_NAME[i] + "_" + database +"." + cp.fileExtension, dao.getColumnCount(), dao.getArrayList(), cp.delimiter);
                        }
-                       // Def Csv Writing end
+                       // Def tsv Writing end
 
                        // Table Contents start
-                       br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_TABLE] + "_" + database +".csv"));
+                       br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_TABLE] + "_" + database + "." + cp.fileExtension));
                        subFolder = new File(folder + "/TABLES");
                        subFolder.mkdir();
                        pw[1] = new PrintWriter(new BufferedWriter(new FileWriter(new File(folder + "/" + cp.SQL_FILE_NAME[cp.CREATE_TABLE]))));
@@ -366,7 +368,8 @@ public class RapideMetaUnloader{
                        colCmnt = "";
                        colType = "";
                        colLen = "";
-                       colDec = "";
+                       colPrec = "";
+                       colScale = "";
                        colNoN = "";
                        colDflt = "";
 
@@ -374,91 +377,96 @@ public class RapideMetaUnloader{
                        StringBuffer sbTbCmnt = new StringBuffer();
                        while((strLine=br[0].readLine()) != null){
                                if(!strLine.equals("")){
-                                       strSplit = CmnUtils.splitCsv(strLine);
+                                       strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
                                        if (!tableName.equals("")){
                                                sbTbCnts.append("    " + cp.sqlQuoted + colName + cp.sqlQuoted);
                                                sbTbCnts.append(" " + colType);
-                                               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("COMMENT ON COLUMN " + cp.sqlQuoted + tableName + cp.sqlQuoted + "." + cp.sqlQuoted + colName + cp.sqlQuoted + " IS '" + colCmnt.replaceAll("'","''") + "';");
                                                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);
-                                                       if (!colLen.equals("") && !colDec.equals(""))sbTbCnts.append("," + colDec);
-                                                       if (!colLen.equals(""))sbTbCnts.append(")");
+                                               if(CmnUtils.isColPrec(colType, colPrec)){
+                                                       sbTbCnts.append("(" + colPrec);
+                                                       if (!colScale.equals(""))sbTbCnts.append("," + colScale);
+                                                       sbTbCnts.append(")");
+                                               } else if (CmnUtils.isColLength(colType, colLen)){
+                                                       sbTbCnts.append("(" + CmnUtils.getColLength(colType, colLen) + ")");
                                                }
                                                if (!colDflt.equals(""))sbTbCnts.append(" DEFAULT " + colDflt.trim());
                                                if (colNoN.equals("\81\9b"))sbTbCnts.append(" NOT NULL");
-                                               if (!strSplit[0].equals(tableName)){
+                                               if (!strSplit[0][0].equals(tableName)){
                                                        pw[1].println("@TABLES/" + tableName + ".sql");
-                                                       pw[2].println("DROP TABLE " + cp.sqlQuoted + tableName + cp.sqlQuoted + " PURGE;");
+                                                       pw[2].println("DROP TABLE " + cp.sqlQuoted + tableName + cp.sqlQuoted + " CASCADE CONSTRAINT PURGE;");
                                                        pw[3].println("TRUNCATE TABLE " + cp.sqlQuoted + tableName + cp.sqlQuoted + ";");
                                                        sbTbCnts.append(cp.lineSeparator);
                                                        sbTbCnts.append(");");
                                                        sbTbCnts.append(cp.lineSeparator);
                                                        pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(new File(subFolder + "/" + tableName + ".sql"))));
-                                                       strSplit2 = CmnUtils.splitCrLf(sbTbCnts.toString());
-                                                       for(int i=0;i<strSplit2.length;i++)if(!strSplit2[i].trim().equals(""))pw[0].println(strSplit2[i]);
-                                                       strSplit3 = CmnUtils.splitCrLf(sbTbCmnt.toString());
-                                                       for(int i=0;i<strSplit3.length;i++)if(!strSplit3[i].trim().equals(""))pw[0].println(strSplit3[i]);
+                                                       strSplit[1] = CmnUtils.splitCrLf(sbTbCnts.toString());
+                                                       for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[0].println(strSplit[1][i]);
+                                                       strSplit[2] = CmnUtils.splitCrLf(sbTbCmnt.toString());
+                                                       for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[0].println(strSplit[2][i]);
                                                        pw[0].close();
                                                        pw[0] = null;
                                                        sbTbCnts = new StringBuffer();
                                                        sbTbCmnt = new StringBuffer();
-                                                       sbTbCnts.append("CREATE TABLE " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted);
+                                                       sbTbCnts.append("CREATE TABLE " + cp.sqlQuoted + strSplit[0][0] + cp.sqlQuoted);
                                                        sbTbCnts.append(cp.lineSeparator);
                                                        sbTbCnts.append("(");
                                                        sbTbCnts.append(cp.lineSeparator);
-                                                       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);
+                                                       if(!strSplit[0][1].equals(""))sbTbCmnt.append("COMMENT ON TABLE " + cp.sqlQuoted + strSplit[0][0] + cp.sqlQuoted + " IS '" + strSplit[0][1].replaceAll("'","''") +"';");
+                                                       if(!strSplit[0][1].equals(""))sbTbCmnt.append(cp.lineSeparator);
                                                } else {
                                                        sbTbCnts.append(",");
                                                        sbTbCnts.append(cp.lineSeparator);
                                                }
                                        }
                                        else {
-                                               sbTbCnts.append("CREATE TABLE " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted);
+                                               sbTbCnts.append("CREATE TABLE " + cp.sqlQuoted + strSplit[0][0] + cp.sqlQuoted);
                                                sbTbCnts.append(cp.lineSeparator);
                                                sbTbCnts.append("(");
                                                sbTbCnts.append(cp.lineSeparator);
-                                               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);
+                                               if(!strSplit[0][1].equals(""))sbTbCmnt.append("COMMENT ON TABLE " + cp.sqlQuoted + strSplit[0][0] + cp.sqlQuoted + " IS '" + strSplit[0][1].replaceAll("'","''") +"';");
+                                               if(!strSplit[0][1].equals(""))sbTbCmnt.append(cp.lineSeparator);
                                        }
-                                       for(int i=0;i<strSplit.length;i++)CmnUtils.debugPrint("'" + strSplit[i] + "'");
+                                       for(int i=0;i<strSplit[0].length;i++)CmnUtils.debugPrint("'" + strSplit[0][i] + "'");
 
-                                       tableName = strSplit[0];
-                                       tableCmnt = strSplit[1];
-                                       colName = strSplit[2];
-                                       colCmnt = strSplit[3];
-                                       colType = strSplit[4];
-                                       colLen = strSplit[5];
-                                       colDec = strSplit[6];
-                                       colNoN = strSplit[7];
-                                       colDflt = strSplit[8];
+                                       tableName = strSplit[0][0];
+                                       tableCmnt = strSplit[0][1];
+                                       colName = strSplit[0][2];
+                                       colCmnt = strSplit[0][3];
+                                       colType = strSplit[0][4];
+                                       colLen = strSplit[0][5];
+                                       colPrec = strSplit[0][6];
+                                       colScale = strSplit[0][7];
+                                       colNoN = strSplit[0][8];
+                                       colDflt = strSplit[0][9];
                                }
                        }
 
                        if (!tableName.equals("")){
                                sbTbCnts.append("    " + cp.sqlQuoted + colName + cp.sqlQuoted);
                                sbTbCnts.append(" " + colType);
-                               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("COMMENT ON COLUMN " + cp.sqlQuoted + tableName + cp.sqlQuoted + "." + cp.sqlQuoted + colName + cp.sqlQuoted + " IS '" + colCmnt.replaceAll("'","''") + "';");
                                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);
-                                       if (!colDec.equals(""))sbTbCnts.append("," + colDec);
-                                       if (!colLen.equals(""))sbTbCnts.append(")");
+                               if(CmnUtils.isColPrec(colType, colPrec)){
+                                       sbTbCnts.append("(" + colPrec);
+                                       if (!colScale.equals(""))sbTbCnts.append("," + colScale);
+                                       sbTbCnts.append(")");
+                               } else if (CmnUtils.isColLength(colType, colLen)){
+                                       sbTbCnts.append("(" + CmnUtils.getColLength(colType, colLen) + ")");
                                }
                                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 " + cp.sqlQuoted + tableName + cp.sqlQuoted + " PURGE;");
+                               pw[2].println("DROP TABLE " + cp.sqlQuoted + tableName + cp.sqlQuoted + " CASCADE CONSTRAINT PURGE;");
                                pw[3].println("TRUNCATE TABLE " + cp.sqlQuoted + tableName + cp.sqlQuoted + ";");
                                sbTbCnts.append(cp.lineSeparator);
                                sbTbCnts.append(");");
                                sbTbCnts.append(cp.lineSeparator);
                                pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(new File(subFolder + "/" + tableName + ".sql"))));
-                               strSplit2 = CmnUtils.splitCrLf(sbTbCnts.toString());
-                               for(int i=0;i<strSplit2.length;i++)if(!strSplit2[i].trim().equals(""))pw[0].println(strSplit2[i]);
-                               strSplit3 = CmnUtils.splitCrLf(sbTbCmnt.toString());
-                               for(int i=0;i<strSplit3.length;i++)if(!strSplit3[i].trim().equals(""))pw[0].println(strSplit3[i]);
+                               strSplit[1] = CmnUtils.splitCrLf(sbTbCnts.toString());
+                               for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[0].println(strSplit[1][i]);
+                               strSplit[2] = CmnUtils.splitCrLf(sbTbCmnt.toString());
+                               for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[0].println(strSplit[2][i]);
                                pw[0].close();
                                pw[0] = null;
                        }
@@ -469,7 +477,7 @@ public class RapideMetaUnloader{
                        // Table Contents end
 
                        // Index Contents start
-                       br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_INDEX] + "_" + database +".csv"));
+                       br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_INDEX] + "_" + database + "." + cp.fileExtension));
                        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]))));
@@ -491,10 +499,10 @@ public class RapideMetaUnloader{
                        //Loop Process
                        while((strLine=br[0].readLine()) != null){
                                if(!strLine.equals("")){
-                                       strSplit = CmnUtils.splitCsv(strLine);
+                                       strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
                                        //Not 1st Line Process
                                        if (!indexName.equals("")){
-                                               if (!strSplit[1].equals(indexName)){
+                                               if (!strSplit[0][1].equals(indexName)){
                                                        //Post Process
                                                        if (colPos.equals("1")){
                                                                sbIxCnts.append(cp.sqlQuoted + colName + cp.sqlQuoted);
@@ -511,21 +519,21 @@ public class RapideMetaUnloader{
 
                                                        //Write Buffer
                                                        if (constraintType.equals("P")){
-                                                               strSplit2 = CmnUtils.splitCrLf(sbIxCnts.toString());
-                                                               for(int i=0;i<strSplit2.length;i++)if(!strSplit2[i].trim().equals(""))pw[0].println(strSplit2[i]);
-                                                               strSplit3 = CmnUtils.splitCrLf(sbIx2Cnts.toString());
-                                                               for(int i=0;i<strSplit3.length;i++)if(!strSplit3[i].trim().equals(""))pw[3].println(strSplit3[i]);
+                                                               strSplit[1] = CmnUtils.splitCrLf(sbIxCnts.toString());
+                                                               for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[0].println(strSplit[1][i]);
+                                                               strSplit[2] = CmnUtils.splitCrLf(sbIx2Cnts.toString());
+                                                               for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[3].println(strSplit[2][i]);
                                                        } else if (constraintType.equals("U")){
-                                                               strSplit2 = CmnUtils.splitCrLf(sbIxCnts.toString());
-                                                               for(int i=0;i<strSplit2.length;i++)if(!strSplit2[i].trim().equals(""))pw[1].println(strSplit2[i]);
-                                                               strSplit3 = CmnUtils.splitCrLf(sbIx2Cnts.toString());
-                                                               for(int i=0;i<strSplit3.length;i++)if(!strSplit3[i].trim().equals(""))pw[4].println(strSplit3[i]);
+                                                               strSplit[1] = CmnUtils.splitCrLf(sbIxCnts.toString());
+                                                               for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[1].println(strSplit[1][i]);
+                                                               strSplit[2] = CmnUtils.splitCrLf(sbIx2Cnts.toString());
+                                                               for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[4].println(strSplit[2][i]);
                                                        } else if (constraintType.equals("")){
-                                                               strSplit2 = CmnUtils.splitCrLf(sbIxCnts.toString());
-                                                               for(int i=0;i<strSplit2.length;i++)if(!strSplit2[i].trim().equals(""))pw[2].println(strSplit2[i]);
+                                                               strSplit[1] = CmnUtils.splitCrLf(sbIxCnts.toString());
+                                                               for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[2].println(strSplit[1][i]);
                                                        }
-                                                       strSplit4 = CmnUtils.splitCrLf(sbIx3Cnts.toString());
-                                                       for(int i=0;i<strSplit4.length;i++)if(!strSplit4[i].trim().equals(""))pw[5].println(strSplit4[i]);
+                                                       strSplit[3] = CmnUtils.splitCrLf(sbIx3Cnts.toString());
+                                                       for(int i=0;i<strSplit[3].length;i++)if(!strSplit[3][i].trim().equals(""))pw[5].println(strSplit[3][i]);
 
                                                        //Initial Process
                                                        sbIxCnts = new StringBuffer();
@@ -533,17 +541,17 @@ public class RapideMetaUnloader{
                                                        sbIx3Cnts = new StringBuffer();
 
                                                        //Index Changed Process
-                                                       if (strSplit[3].equals("P")){
-                                                               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 " + 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 " + cp.sqlQuoted + strSplit[1] + cp.sqlQuoted + " ON " + strSplit[0] + "(");
+                                                       if (strSplit[0][3].equals("P")){
+                                                               sbIxCnts.append("ALTER TABLE " + cp.sqlQuoted + strSplit[0][0] + cp.sqlQuoted + " ADD CONSTRAINT " + cp.sqlQuoted + strSplit[0][1] + cp.sqlQuoted + " PRIMARY KEY(");
+                                                               sbIx2Cnts.append("ALTER TABLE " + cp.sqlQuoted + strSplit[0][0] + cp.sqlQuoted + " DROP CONSTRAINT " + cp.sqlQuoted + strSplit[0][1] + cp.sqlQuoted + ";");
+                                                       } else if (strSplit[0][3].equals("U")){
+                                                               sbIxCnts.append("ALTER TABLE " + cp.sqlQuoted + strSplit[0][0] + cp.sqlQuoted + " ADD CONSTRAINT " + cp.sqlQuoted + strSplit[0][1] + cp.sqlQuoted + " UNIQUE(");
+                                                               sbIx2Cnts.append("ALTER TABLE " + cp.sqlQuoted + strSplit[0][0] + cp.sqlQuoted + " DROP UNIQUE(");
+                                                       } else if (strSplit[0][3].equals("")){
+                                                               sbIxCnts.append("CREATE INDEX " + cp.sqlQuoted + strSplit[0][1] + cp.sqlQuoted + " ON " + strSplit[0][0] + "(");
                                                        }
-                                                       sbIx3Cnts.append("DROP INDEX " + cp.sqlQuoted + strSplit[1] + cp.sqlQuoted + ";");
-                                               } else if (strSplit[1].equals(indexName)){
+                                                       sbIx3Cnts.append("DROP INDEX " + cp.sqlQuoted + strSplit[0][1] + cp.sqlQuoted + ";");
+                                               } else if (strSplit[0][1].equals(indexName)){
                                                        if (colPos.equals("1")){
                                                                sbIxCnts.append(cp.sqlQuoted + colName + cp.sqlQuoted);
                                                                if (constraintType.equals("U"))sbIx2Cnts.append(cp.sqlQuoted + colName + cp.sqlQuoted);
@@ -556,25 +564,25 @@ public class RapideMetaUnloader{
 
                                        //1st Line Process
                                        else {
-                                               if (strSplit[3].equals("P")){
-                                                       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 " + 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 " + cp.sqlQuoted + strSplit[1] + cp.sqlQuoted + " ON " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted + "(");
+                                               if (strSplit[0][3].equals("P")){
+                                                       sbIxCnts.append("ALTER TABLE " + cp.sqlQuoted + strSplit[0][0] + cp.sqlQuoted + " ADD CONSTRAINT " + cp.sqlQuoted + strSplit[0][1] + cp.sqlQuoted + " PRIMARY KEY(");
+                                                       sbIx2Cnts.append("ALTER TABLE " + cp.sqlQuoted + strSplit[0][0] + cp.sqlQuoted + " DROP CONSTRAINT " + cp.sqlQuoted + strSplit[0][1] + cp.sqlQuoted + ";");
+                                               } else if (strSplit[0][3].equals("U")){
+                                                       sbIxCnts.append("ALTER TABLE " + cp.sqlQuoted + strSplit[0][0] + cp.sqlQuoted + " ADD CONSTRAINT " + cp.sqlQuoted + strSplit[0][1] + cp.sqlQuoted + " UNIQUE(");
+                                                       sbIx2Cnts.append("ALTER TABLE " + cp.sqlQuoted + strSplit[0][0] + cp.sqlQuoted + " DROP UNIQUE(");
+                                               } else if (strSplit[0][3].equals("")){
+                                                       sbIxCnts.append("CREATE INDEX " + cp.sqlQuoted + strSplit[0][1] + cp.sqlQuoted + " ON " + cp.sqlQuoted + strSplit[0][0] + cp.sqlQuoted + "(");
                                                }
-                                               sbIx3Cnts.append("DROP INDEX " + cp.sqlQuoted + strSplit[1] + cp.sqlQuoted + ";");
+                                               sbIx3Cnts.append("DROP INDEX " + cp.sqlQuoted + strSplit[0][1] + cp.sqlQuoted + ";");
                                        }
-                                       for(int i=0;i<strSplit.length;i++)CmnUtils.debugPrint("'" + strSplit[i] + "'");
+                                       for(int i=0;i<strSplit[0].length;i++)CmnUtils.debugPrint("'" + strSplit[0][i] + "'");
 
-                                       tableName = strSplit[0];
-                                       indexName = strSplit[1];
-                                       indexType = strSplit[2];
-                                       constraintType = strSplit[3];
-                                       colName = strSplit[4];
-                                       colPos = strSplit[5];
+                                       tableName = strSplit[0][0];
+                                       indexName = strSplit[0][1];
+                                       indexType = strSplit[0][2];
+                                       constraintType = strSplit[0][3];
+                                       colName = strSplit[0][4];
+                                       colPos = strSplit[0][5];
                                }
                        }
                        if (!indexName.equals("")){
@@ -594,21 +602,21 @@ public class RapideMetaUnloader{
 
                                //Write Buffer
                                if (constraintType.equals("P")){
-                                       strSplit2 = CmnUtils.splitCrLf(sbIxCnts.toString());
-                                       for(int i=0;i<strSplit2.length;i++)if(!strSplit2[i].trim().equals(""))pw[0].println(strSplit2[i]);
-                                       strSplit3 = CmnUtils.splitCrLf(sbIx2Cnts.toString());
-                                       for(int i=0;i<strSplit3.length;i++)if(!strSplit3[i].trim().equals(""))pw[3].println(strSplit3[i]);
+                                       strSplit[1] = CmnUtils.splitCrLf(sbIxCnts.toString());
+                                       for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[0].println(strSplit[1][i]);
+                                       strSplit[2] = CmnUtils.splitCrLf(sbIx2Cnts.toString());
+                                       for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[3].println(strSplit[2][i]);
                                } else if (constraintType.equals("U")){
-                                       strSplit2 = CmnUtils.splitCrLf(sbIxCnts.toString());
-                                       for(int i=0;i<strSplit2.length;i++)if(!strSplit2[i].trim().equals(""))pw[1].println(strSplit2[i]);
-                                       strSplit3 = CmnUtils.splitCrLf(sbIx2Cnts.toString());
-                                       for(int i=0;i<strSplit3.length;i++)if(!strSplit3[i].trim().equals(""))pw[4].println(strSplit3[i]);
+                                       strSplit[1] = CmnUtils.splitCrLf(sbIxCnts.toString());
+                                       for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[1].println(strSplit[1][i]);
+                                       strSplit[2] = CmnUtils.splitCrLf(sbIx2Cnts.toString());
+                                       for(int i=0;i<strSplit[2].length;i++)if(!strSplit[2][i].trim().equals(""))pw[4].println(strSplit[2][i]);
                                } else if (constraintType.equals("")){
-                                       strSplit2 = CmnUtils.splitCrLf(sbIxCnts.toString());
-                                       for(int i=0;i<strSplit2.length;i++)if(!strSplit2[i].trim().equals(""))pw[2].println(strSplit2[i]);
+                                       strSplit[1] = CmnUtils.splitCrLf(sbIxCnts.toString());
+                                       for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[2].println(strSplit[1][i]);
                                }
-                               strSplit4 = CmnUtils.splitCrLf(sbIx3Cnts.toString());
-                               for(int i=0;i<strSplit4.length;i++)if(!strSplit4[i].trim().equals(""))pw[5].println(strSplit4[i]);
+                               strSplit[3] = CmnUtils.splitCrLf(sbIx3Cnts.toString());
+                               for(int i=0;i<strSplit[3].length;i++)if(!strSplit[3][i].trim().equals(""))pw[5].println(strSplit[3][i]);
                        }
 
                        //Close Buffer
@@ -619,25 +627,25 @@ public class RapideMetaUnloader{
                        // Index Contents end
 
                        // View Contents start
-                       br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_VIEW] + "_" + database +".csv"));
+                       br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_VIEW] + "_" + database + "." + cp.fileExtension));
                        subFolder = new File(folder + "/VIEWS");
                        subFolder.mkdir();
                        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] + "'");
-                               pw[1].println("@VIEWS/" + strSplit[0] + ".sql");
-                               pw[2].println("DROP VIEW \"" + strSplit[0] + "\";");
-                               if (strSplit.length>1)CmnUtils.debugPrint("'" + strSplit[1] + "'");
-                               pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(new File(subFolder + "/" + strSplit[0] + ".sql"))));
+                               strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
+                               CmnUtils.debugPrint("'" + strSplit[0][0] + "'");
+                               pw[1].println("@VIEWS/" + strSplit[0][0] + ".sql");
+                               pw[2].println("DROP VIEW " + cp.sqlQuoted + strSplit[0][0] + cp.sqlQuoted + ";");
+                               if (strSplit[0].length>1)CmnUtils.debugPrint("'" + strSplit[0][1] + "'");
+                               pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(new File(subFolder + "/" + strSplit[0][0] + ".sql"))));
                                stmt = dao.prepareSql(sql_view_column_and_comment);
-                               stmt.setString(1,strSplit[0]);
+                               stmt.setString(1,strSplit[0][0]);
                                dao.executeSql();
                                alData = dao.getArrayList();
                                columnCount = dao.getColumnCount();
-                               pw[0].println("/* " + strSplit[0] + " */");
-                               pw[0].println("CREATE OR REPLACE VIEW " + strSplit[0]);
+                               pw[0].println("/* " + strSplit[0][0] + " */");
+                               pw[0].println("CREATE OR REPLACE VIEW " + cp.sqlQuoted + strSplit[0][0] + cp.sqlQuoted);
                                pw[0].println("(");
                                for(int i=0;i<alData.size();i++){
                                        if ((i+1) % columnCount == 1){
@@ -659,17 +667,17 @@ public class RapideMetaUnloader{
                                pw[0].println(")");
                                pw[0].println("AS");
                                stmt = dao.prepareSql(sql_view_text);
-                               stmt.setString(1,strSplit[0]);
+                               stmt.setString(1,strSplit[0][0]);
                                dao.executeSql();
                                alData2 = dao.getArrayList();
-                               strContents = alData2.get(0).trim().replaceAll("\n",cp.lineSeparator);
-                               strSplit2 = CmnUtils.splitCrLf(strContents);
-                               for(int i=0;i<strSplit2.length;i++)if(!strSplit2[i].trim().equals(""))pw[0].println(strSplit2[i]);
+                               strContents = alData2.get(0).trim();
+                               strSplit[1] = CmnUtils.splitCrLf(strContents);
+                               for(int i=0;i<strSplit[1].length;i++)if(!strSplit[1][i].trim().equals(""))pw[0].println(strSplit[1][i].replaceAll("\"\"","\"").replaceAll(Pattern.quote(cp.user.toUpperCase() + "."),"").replaceAll(Pattern.quote(cp.user.toLowerCase() + "."),""));
                                pw[0].println(";");
-                               if (!strSplit[1].equals(""))pw[0].println("COMMENT ON TABLE " + cp.sqlQuoted + strSplit[0] + cp.sqlQuoted + " IS '" + strSplit[1] + "';");
+                               if (!strSplit[0][1].equals(""))pw[0].println("COMMENT ON TABLE " + cp.sqlQuoted + strSplit[0][0] + cp.sqlQuoted + " IS '" + strSplit[0][1].replaceAll("'","''") + "';");
                                for(int i=0;i<alData.size();i++){
                                        if ((i+1) % columnCount == 0){
-                                               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) + "';");
+                                               if (!alData.get(i).equals(""))pw[0].println("COMMENT ON COLUMN " + cp.sqlQuoted + strSplit[0][0] + cp.sqlQuoted + "." + alData.get(i-1) + " IS '" + alData.get(i).replaceAll("'","''") + "';");
                                        }
                                }
                                pw[0].close();
@@ -682,29 +690,29 @@ public class RapideMetaUnloader{
                        // View Contents end
 
                        // Procedure Contents start
-                       br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_PROCEDURE] + "_" + database +".csv"));
+                       br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_PROCEDURE] + "_" + database + "." + cp.fileExtension));
                        subFolder = new File(folder + "/PROCEDURES");
                        subFolder.mkdir();
                        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] + "'");
-                               pw[1].println("@PROCEDURES/" + strSplit[0] + ".sql");
-                               pw[2].println("DROP " + strSplit[1] + " " + strSplit[0] + ";");
-                               if (strSplit.length>1)CmnUtils.debugPrint("'" + strSplit[1] + "'");
-                               pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(new File(subFolder + "/" + strSplit[0] + ".sql"))));
-                               pw[0].println("/* " + strSplit[0] + " */");
+                               strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
+                               CmnUtils.debugPrint("'" + strSplit[0][0] + "'");
+                               pw[1].println("@PROCEDURES/" + strSplit[0][0] + ".sql");
+                               pw[2].println("DROP " + strSplit[0][1] + " " + strSplit[0][0] + ";");
+                               if (strSplit[0].length>1)CmnUtils.debugPrint("'" + strSplit[0][1] + "'");
+                               pw[0] = new PrintWriter(new BufferedWriter(new FileWriter(new File(subFolder + "/" + strSplit[0][0] + ".sql"))));
+                               pw[0].println("/* " + strSplit[0][0] + " */");
                                pw[0].print("CREATE OR REPLACE ");
                                stmt = dao.prepareSql(sql_proc);
-                               stmt.setString(1,strSplit[0]);
+                               stmt.setString(1,strSplit[0][0]);
                                dao.executeSql();
                                alData = dao.getArrayList();
                                for(int i=0;i<alData.size();i++){
-                                       strContents = alData.get(i).replaceAll("\n","");
-                                       if(!strContents.equals(""))pw[0].println(strContents);
+                                       strContents = alData.get(i);
+                                       if(!strContents.equals(""))pw[0].println(strContents.replaceAll(Pattern.quote(cp.user.toUpperCase() + "."),"").replaceAll(Pattern.quote(cp.user.toLowerCase() + "."),""));
                                }
-                               pw[0].println("/");
+                               //pw[0].println("/");
                                pw[0].close();
                                pw[0] = null;
                        }
@@ -715,21 +723,22 @@ public class RapideMetaUnloader{
                        // Procedure Contents end
 
                        // Sequence Contents start
-                       br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_SEQ] + "_" + database +".csv"));
+                       br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_SEQ] + "_" + database + "." + cp.fileExtension));
                        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);
-                               seqName = strSplit[0];
-                               minVal = strSplit[1];
-                               maxVal = strSplit[2];
-                               incSz = strSplit[3];
-                               cycFg = strSplit[4];
-                               odFg = strSplit[5];
-                               cacheSz = strSplit[6];
-                               lstNo = strSplit[7];
-                               pw[1].print("CREATE SEQUENCE \"" + cp.sqlQuoted + seqName + cp.sqlQuoted + "\" MINVALUE " + minVal + " MAXVALUE " + maxVal + " INCREMENT BY " + incSz + " START WITH " + lstNo + " CACHE " + cacheSz);
+                               strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
+                               seqName = strSplit[0][0];
+                               minVal = strSplit[0][1];
+                               maxVal = strSplit[0][2];
+                               incSz = strSplit[0][3];
+                               cycFg = strSplit[0][4];
+                               odFg = strSplit[0][5];
+                               cacheSz = strSplit[0][6];
+                               if(cacheSz.equals("0"))cacheSz="10";
+                               lstNo = strSplit[0][7];
+                               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 {
@@ -741,8 +750,8 @@ public class RapideMetaUnloader{
                                        pw[1].print(" CYCLE");
                                }
                                pw[1].println(";");
-                               pw[2].println("DROP SEQUENCE \"" + cp.sqlQuoted + seqName + cp.sqlQuoted + "\";");
-                               for(int i=0;i<strSplit.length;i++)CmnUtils.debugPrint("'" + strSplit[i] + "'");
+                               pw[2].println("DROP SEQUENCE " + cp.sqlQuoted + seqName + cp.sqlQuoted + ";");
+                               for(int i=0;i<strSplit[0].length;i++)CmnUtils.debugPrint("'" + strSplit[0][i] + "'");
                        }
                        for(int i=1;i<3;i++)pw[i].close();
                        for(int i=1;i<3;i++)pw[i]=null;
@@ -751,16 +760,16 @@ public class RapideMetaUnloader{
                        // Sequence Contents end
 
                        // Synonym Contents start
-                       br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_SYNONYM] + "_" + database +".csv"));
+                       br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_SYNONYM] + "_" + database + "." + cp.fileExtension));
                        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);
-                               synmName = strSplit[0];
-                               tbOwner = strSplit[1];
-                               tbName = strSplit[2];
-                               dbLnk = strSplit[3];
+                               strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
+                               synmName = strSplit[0][0];
+                               tbOwner = strSplit[0][1];
+                               tbName = strSplit[0][2];
+                               dbLnk = strSplit[0][3];
                                
                                pw[1].print("CREATE SYNONYM " + cp.sqlQuoted + synmName + cp.sqlQuoted + " FOR ");
                                if(dbLnk.equals("")){
@@ -770,7 +779,7 @@ public class RapideMetaUnloader{
                                }
                                pw[1].println(";");
                                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=0;i<strSplit[0].length;i++)CmnUtils.debugPrint("'" + strSplit[0][i] + "'");
                        }
                        for(int i=1;i<3;i++)pw[i].close();
                        for(int i=1;i<3;i++)pw[i]=null;
@@ -779,9 +788,9 @@ public class RapideMetaUnloader{
                        // Synonym 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"));
+                       File tsvFile = new File(folder + "/" + FILE_NAME[FL_FK] + "_" + database + "." + cp.fileExtension);
+                       if (tsvFile.length() > 0) {
+                               br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_FK] + "_" + database + "." + cp.fileExtension));
                                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 = "";
@@ -794,40 +803,40 @@ public class RapideMetaUnloader{
                                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];
+                                       strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
+                                       if(!fkName.equals(strSplit[0][1]) && !fkName.equals("")){
+                                               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 + tbName + cp.sqlQuoted + " DROP CONSTRAINT " + cp.sqlQuoted + fkName + cp.sqlQuoted + ";");
+                                               for(int i=0;i<strSplit[0].length;i++)CmnUtils.debugPrint("'" + strSplit[0][i] + "'");
+                                               tbName = strSplit[0][0];
+                                               fkName = strSplit[0][1];
+                                               fkCol = strSplit[0][2];
+                                               fkColPos = strSplit[0][3];
+                                               rtbName = strSplit[0][4];
+                                               rfkName = strSplit[0][5];
+                                               rfkCol = strSplit[0][6];
+                                               rfkColPos = strSplit[0][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];
+                                                       tbName = strSplit[0][0];
+                                                       fkName = strSplit[0][1];
+                                                       fkCol = strSplit[0][2];
+                                                       fkColPos = strSplit[0][3];
+                                                       rtbName = strSplit[0][4];
+                                                       rfkName = strSplit[0][5];
+                                                       rfkCol = strSplit[0][6];
+                                                       rfkColPos = strSplit[0][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;
+                                                       if (strSplit[0][3].equals(strSplit[0][7])) {
+                                                               fkCol = fkCol + cp.sqlQuoted + ", " + cp.sqlQuoted + strSplit[0][2];
+                                                               rfkCol = rfkCol + cp.sqlQuoted + ", " + cp.sqlQuoted + strSplit[0][6];
                                                        }
                                                }
                                        }
                                        
                                }
                                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 + ";");
+                               pw[2].println("ALTER TABLE " + 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();
@@ -838,7 +847,7 @@ public class RapideMetaUnloader{
                        // Rhysical Contents start
                        if(cp.isPhysical){
                                // physical index setting
-                               br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_OBJ] + "_" + database +".csv"));
+                               br[0] = new BufferedReader(new FileReader(folder + "/" + FILE_NAME[FL_OBJ] + "_" + database + "." + cp.fileExtension));
                                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]));
@@ -849,15 +858,15 @@ public class RapideMetaUnloader{
                                int rowNo;
                                String [] rowData;
                                while((strLine=br[0].readLine()) != null){
-                                       strSplit = CmnUtils.splitCsv(strLine);
-                                       for(int i=0;i<strSplit.length;i++)alData.add(strSplit[i]);
+                                       strSplit[0] = CmnUtils.split(strLine, cp.delimiter);
+                                       for(int i=0;i<strSplit[0].length;i++)alData.add(strSplit[0][i]);
                                }
                                while((strLine=br[1].readLine()) != null){
-                                       strSplit = CmnUtils.splitSpace(strLine);
-                                       rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[5].replaceAll(cp.sqlQuoted,""));
+                                       strSplit[0] = CmnUtils.splitSpace(strLine);
+                                       rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[0][5].replaceAll(cp.sqlQuoted,""));
                                        if (rowNo != -1){
                                                rowData = rowData = CmnUtils.getArrayRowData(alData, 12, rowNo);
-                                               CmnUtils.debugPrint(strSplit[5] + ":" + rowNo);
+                                               CmnUtils.debugPrint(strSplit[0][5] + ":" + rowNo);
                                                for(int i=0;i<rowData.length;i++)CmnUtils.debugPrint(rowData[i]);
                                                tbName = rowData[0];
                                                objName = rowData[1];
@@ -885,15 +894,15 @@ public class RapideMetaUnloader{
                                                }
                                        } else {
                                                pw[1].println(strLine);
-                                               CmnUtils.errorPrint(strSplit[5] + ",UNUSABLE INDEX");
+                                               CmnUtils.errorPrint(strSplit[0][5] + ",UNUSABLE INDEX");
                                        }
                                }
                                while((strLine=br[2].readLine()) != null){
-                                       strSplit = CmnUtils.splitSpace(strLine);
-                                       rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[5].replaceAll(cp.sqlQuoted,""));
+                                       strSplit[0] = CmnUtils.splitSpace(strLine);
+                                       rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[0][5].replaceAll(cp.sqlQuoted,""));
                                        if (rowNo != -1){
                                                rowData = rowData = CmnUtils.getArrayRowData(alData, 12, rowNo);
-                                               CmnUtils.debugPrint(strSplit[5] + ":" + rowNo);
+                                               CmnUtils.debugPrint(strSplit[0][5] + ":" + rowNo);
                                                for(int i=0;i<rowData.length;i++)CmnUtils.debugPrint(rowData[i]);
                                                tbName = rowData[0];
                                                objName = rowData[1];
@@ -921,12 +930,12 @@ public class RapideMetaUnloader{
                                                }
                                        } else {
                                                pw[2].println(strLine);
-                                               CmnUtils.errorPrint(strSplit[5] + ",UNUSABLE INDEX");
+                                               CmnUtils.errorPrint(strSplit[0][5] + ",UNUSABLE INDEX");
                                        }
                                }
                                while((strLine=br[3].readLine()) != null){
-                                       strSplit = CmnUtils.splitSpace(strLine);
-                                       rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[2].replaceAll(cp.sqlQuoted,""));
+                                       strSplit[0] = CmnUtils.splitSpace(strLine);
+                                       rowNo = CmnUtils.getArrayRowNo(alData, 12, 1, strSplit[0][2].replaceAll(cp.sqlQuoted,""));
                                        CmnUtils.debugPrint("rowNo=" + rowNo);
                                        if (rowNo != -1){
                                                rowData = CmnUtils.getArrayRowData(alData, 12, rowNo);
@@ -957,7 +966,7 @@ public class RapideMetaUnloader{
                                                }
                                        } else {
                                                pw[3].println(strLine);
-                                               CmnUtils.errorPrint(strSplit[2] + ",UNUSABLE INDEX");
+                                               CmnUtils.errorPrint(strSplit[0][2] + ",UNUSABLE INDEX");
                                        }
                                }
                                for(int i=1;i<4;i++)pw[i].close();
@@ -1042,8 +1051,8 @@ public class RapideMetaUnloader{
 
                        // Remove work file
                        File fl= null;
-                       for(int i=0;i<sql.length;i++){
-                               fl= new File(folder + "/" + FILE_NAME[i] + "_" + database +".csv");
+                       for(int i=0;i<sql[cp.dbType].length;i++){
+                               fl= new File(folder + "/" + FILE_NAME[i] + "_" + database + "." + cp.fileExtension);
                                CmnUtils.debugPrint(fl.toString());
                                fl.delete();
                        }