OSDN Git Service

20170314
authorkuboryu <kuboryu@yahoo.co.jp>
Tue, 14 Mar 2017 11:11:17 +0000 (20:11 +0900)
committerkuboryu <kuboryu@yahoo.co.jp>
Tue, 14 Mar 2017 11:11:17 +0000 (20:11 +0900)
com/rapide_act/CmnProperty.java
com/rapide_act/CmnUtils.java
com/rapide_act/DataAccessObjects.java
com/rapide_act/RapideLoader.java

index 5a38c52..e8d96ce 100644 (file)
@@ -32,11 +32,11 @@ public class CmnProperty{
        protected static final int DB_TYPE_ORACLE = 0;
        protected static final int DB_TYPE_SQLSERVER = 1;
        protected static final int DB_TYPE_MYSQL = 2;
-//     protected static final int DB_TYPE_DB2 = 3;
+       protected static final int DB_TYPE_DB2 = 3;
 //     protected static final int DB_TYPE_POSTGRESQL = 4;
        protected static final int DB_TYPE_UNKNOWN = -1;
-       protected static final String [] DB_TYPE_NAME = {"ORACLE", "SQLSERVER", "MYSQL"};
-       protected static final String [] DB_SQL_QUOTED = {"\"", "\"", "`"};
+       protected static final String [] DB_TYPE_NAME = {"ORACLE", "SQLSERVER", "MYSQL", "DB2"};
+       protected static final String [] DB_SQL_QUOTED = {"\"", "\"", "`", "\""};
        protected static final int MASK_PTN_ALL = 0;
        protected static final int MASK_PTN_ALT = 1;
        protected static final int MASK_PTN_EDGE = 2;
@@ -92,7 +92,12 @@ public class CmnProperty{
                + " table_name "
                + " from information_schema.TABLES "
                + " where TABLE_TYPE = 'BASE TABLE' and TABLE_SCHEMA = database() "
-               + " order by table_name"
+               + " order by table_name",
+               "select "
+               + " tabname "
+               + " from syscat.tables "
+               + " where tabschema = CURRENT_SCHEMA and ownertype = 'U' and type = 'T' "
+               + " order by tabname"
        };
        protected static final String [] TK_SQL_ARRAY = {
                "select "
@@ -141,7 +146,41 @@ public class CmnProperty{
                + "  and a.TABLE_NAME = b.TABLE_NAME "
                + "  and b.CONSTRAINT_NAME = 'PRIMARY' "
                + " order by "
-               + "  a.table_name,b.ORDINAL_POSITION"
+               + "  a.table_name,b.ORDINAL_POSITION",
+               "select"
+               + " a.tabname,"
+               + " b.colname"
+               + " from"
+               + " ("
+               + "  select"
+               + "    tabschema,"
+               + "    tabname "
+               + "  from"
+               + "    syscat.tables"
+               + "  where"
+               + "    tabschema = CURRENT_SCHEMA"
+               + "    and ownertype = 'U'"
+               + "    and type = 'T'"
+               + "  ) a"
+               + "  left outer join "
+               + "  ("
+               + "  select"
+               + "    c.tabschema,"
+               + "    c.tabname,"
+               + "    c.colname,"
+               + "    c.colseq"
+               + "  from"
+               + "    syscat.keycoluse c,"
+               + "    syscat.tabconst d"
+               + "  where"
+               + "    c.tabschema = CURRENT_SCHEMA"
+               + "    and c.tabschema = d.tabschema"
+               + "    and c.constname = d.constname"
+               + "    and d.type = 'P'"
+               + "  group by c.tabschema,c.tabname,c.colname,c.colseq"
+               + "  ) b "
+               + " on a.tabschema = b.tabschema and a.tabname = b.tabname"
+               + " order by a.tabname,b.colseq"
        };
        
        protected String user                                   = null;
index b4109cb..fdb8711 100644 (file)
@@ -296,12 +296,17 @@ public class CmnUtils{
                        _str.toUpperCase().equals("UNIQUEIDENTIFIER") ||
                        _str.toUpperCase().equals("TEXT") ||
                        _str.toUpperCase().equals("NTEXT") ||
+                       _str.toUpperCase().equals("CHARACTER") ||
                        _str.toUpperCase().equals("CHAR") ||
                        _str.toUpperCase().equals("NCHAR") ||
                        _str.toUpperCase().equals("VARCHAR") ||
                        _str.toUpperCase().equals("VARCHAR2") ||
                        _str.toUpperCase().equals("NVARCHAR") ||
                        _str.toUpperCase().equals("NVARCHAR2") ||
+                       _str.toUpperCase().equals("LONG VARCHAR") ||
+                       _str.toUpperCase().equals("GRAPHIC") ||
+                       _str.toUpperCase().equals("VARGRAPHIC") ||
+                       _str.toUpperCase().equals("LONG VARGRAPHIC") ||
                        _str.toUpperCase().equals("MVARCHAR")){
                        return true;
                } else {
@@ -354,6 +359,7 @@ public class CmnUtils{
                        _str.toUpperCase().equals("NUMBER") ||
                        _str.toUpperCase().equals("MONEY") ||
                        _str.toUpperCase().equals("SMALLMONEY") ||
+                       _str.toUpperCase().equals("DECFLOAT") ||
                        _str.toUpperCase().equals("DECIMAL")){
                        return true;
                } else {
@@ -410,6 +416,7 @@ public class CmnUtils{
        protected static boolean isColDouble(String _str) throws Exception{
                if(
                        _str.toUpperCase().equals("FLOAT") ||
+                       _str.toUpperCase().equals("DOUBLE") ||
                        _str.toUpperCase().equals("DOUBLE PRECISION")){
                        return true;
                } else {
index 74fcd27..37c29e4 100644 (file)
@@ -517,10 +517,142 @@ public class DataAccessObjects{
                                colString = CmnUtils.clobToString(colClob);
                        }
                } else {
-                       throw new Exception("unmatch column type=" + _colTypeName);
+                       throw new Exception("\83J\83\89\83\80\82Ì\83f\81[\83^\8c^\82ª\91Î\8fÛ\8aO\82Å\82·\81B[" + _colTypeName  + "]");
                }
                return colString;
+       }
 
+       protected void setColString(PreparedStatement stmt_ins, String [] colData, int ins_col_count, int [] tb_col_seq, int [] fl_col_seq) throws Exception{
+
+               if (CmnUtils.isColString(colTypeName[tb_col_seq[ins_col_count]])){
+                       if(cp.isMask){
+                               if(
+                                       (cp.isInclColsMask &&
+                                        !cp.isExclColsMask && 
+                                        CmnUtils.isMatch(cp.inclColsMaskArray,tbName.toUpperCase(), colName[tb_col_seq[ins_col_count]].toUpperCase())
+                                       ) ||
+                                       (cp.isInclColsMask &&
+                                        cp.isExclColsMask && 
+                                        CmnUtils.isMatch(cp.inclColsMaskArray,tbName.toUpperCase(), colName[tb_col_seq[ins_col_count]].toUpperCase()) &&
+                                        !CmnUtils.isMatch(cp.exclColsMaskArray,tbName.toUpperCase(),colName[tb_col_seq[ins_col_count]].toUpperCase())
+                                       ) ||
+                                       (!cp.isInclColsMask &&
+                                        cp.isExclColsMask && 
+                                        !CmnUtils.isMatch(cp.exclColsMaskArray,tbName.toUpperCase(),colName[tb_col_seq[ins_col_count]].toUpperCase())
+                                       )
+                               ){
+                                       StringBuffer sb = new StringBuffer();
+                                       for(int l=0;l<colData[fl_col_seq[ins_col_count]].length();l++){
+                                               if((cp.maskPattern.toUpperCase().equals(cp.MASK_PTN[cp.MASK_PTN_ALT]) && 
+                                                               (l % 2) == 1) || 
+                                                  (cp.maskPattern.toUpperCase().equals(cp.MASK_PTN[cp.MASK_PTN_EDGE]) && 
+                                                               !(l == 0 || ins_col_count == colData[fl_col_seq[ins_col_count]].length() - 1) ||
+                                                  (cp.maskPattern.toUpperCase().equals(cp.MASK_PTN[cp.MASK_PTN_ALL]))
+                                                  )
+                                               ){
+                                                       if(CmnUtils.isHankaku(colData[fl_col_seq[ins_col_count]].charAt(l))){
+                                                               sb.append(cp.singleByteMaskChar);
+                                                       } else {
+                                                               sb.append(cp.doubleByteMaskChar);
+                                                       }
+                                               } else {
+                                                       sb.append(colData[fl_col_seq[ins_col_count]].charAt(l));
+                                               }
+                                       }
+                                       colData[fl_col_seq[ins_col_count]] = sb.toString();
+                               }
+                       }
+                       if (!colData[fl_col_seq[ins_col_count]].equals("")){
+                               if(cp.isQuotation){
+                                       stmt_ins.setString(ins_col_count+1,colData[fl_col_seq[ins_col_count]].replaceAll("\"\"","\""));
+                               } else {
+                                       stmt_ins.setString(ins_col_count+1,colData[fl_col_seq[ins_col_count]]);
+                               }
+                       } else {
+                               stmt_ins.setString(ins_col_count+1,null);
+                       }
+               } else if (CmnUtils.isColDate(colTypeName[tb_col_seq[ins_col_count]])){
+                       if (!colData[fl_col_seq[ins_col_count]].equals("")){
+                               stmt_ins.setDate(ins_col_count+1,java.sql.Date.valueOf(colData[fl_col_seq[ins_col_count]]));
+                       } else {
+                               stmt_ins.setDate(ins_col_count+1,null);
+                       }
+               } else if (CmnUtils.isColYear(colTypeName[tb_col_seq[ins_col_count]])){
+                       if (!colData[fl_col_seq[ins_col_count]].equals("")){
+                               stmt_ins.setString(ins_col_count+1,colData[fl_col_seq[ins_col_count]]);
+                       } else {
+                               stmt_ins.setDate(ins_col_count+1,null);
+                       }
+               } else if (CmnUtils.isColTime(colTypeName[tb_col_seq[ins_col_count]])){
+                       if (!colData[fl_col_seq[ins_col_count]].equals("")){
+                               stmt_ins.setTime(ins_col_count+1,java.sql.Time.valueOf(colData[fl_col_seq[ins_col_count]]));
+                       } else {
+                               stmt_ins.setTime(ins_col_count+1,null);
+                       }
+               } else if (CmnUtils.isColTimestamp(colTypeName[tb_col_seq[ins_col_count]])){
+                       if (!colData[fl_col_seq[ins_col_count]].equals("")){
+                               stmt_ins.setTimestamp(ins_col_count+1,java.sql.Timestamp.valueOf(colData[fl_col_seq[ins_col_count]]));
+                               //CmnUtils.debugPrint("Timestamp=" + colData[fl_col_seq[ins_col_count]]);
+                       } else {
+                               stmt_ins.setTimestamp(ins_col_count+1,null);
+                       }
+               } else if (CmnUtils.isColBigDecimal(colTypeName[tb_col_seq[ins_col_count]])){
+                       if (!colData[fl_col_seq[ins_col_count]].equals("")){
+                               stmt_ins.setBigDecimal(ins_col_count+1,new BigDecimal(colData[fl_col_seq[ins_col_count]]));
+                       } else {
+                               stmt_ins.setNull(ins_col_count+1,java.sql.Types.DECIMAL);
+                       }
+               } else if (CmnUtils.isColShort(colTypeName[tb_col_seq[ins_col_count]])){
+                       if (!colData[fl_col_seq[ins_col_count]].equals("")){
+                               stmt_ins.setShort(ins_col_count+1,Short.parseShort(colData[fl_col_seq[ins_col_count]]));
+                       } else {
+                               stmt_ins.setNull(ins_col_count+1,java.sql.Types.SMALLINT);
+                       }
+               } else if (CmnUtils.isColInt(colTypeName[tb_col_seq[ins_col_count]])){
+                       if (!colData[fl_col_seq[ins_col_count]].equals("")){
+                               stmt_ins.setInt(ins_col_count+1,Integer.parseInt(colData[fl_col_seq[ins_col_count]]));
+                       } else {
+                               stmt_ins.setNull(ins_col_count+1,java.sql.Types.INTEGER);
+                       }
+               } else if (CmnUtils.isColLong(colTypeName[tb_col_seq[ins_col_count]])){
+                       if (!colData[fl_col_seq[ins_col_count]].equals("")){
+                               stmt_ins.setLong(ins_col_count+1,Long.parseLong(colData[fl_col_seq[ins_col_count]]));
+                       } else {
+                               stmt_ins.setNull(ins_col_count+1,java.sql.Types.BIGINT);
+                       }
+               } else if (CmnUtils.isColFloat(colTypeName[tb_col_seq[ins_col_count]])){
+                       if (!colData[fl_col_seq[ins_col_count]].equals("")){
+                               stmt_ins.setFloat(ins_col_count+1,Float.parseFloat(colData[fl_col_seq[ins_col_count]]));
+                       } else {
+                               stmt_ins.setNull(ins_col_count+1,java.sql.Types.REAL);
+                       }
+               } else if (CmnUtils.isColDouble(colTypeName[tb_col_seq[ins_col_count]])){
+                       if (!colData[fl_col_seq[ins_col_count]].equals("")){
+                               stmt_ins.setDouble(ins_col_count+1,Double.parseDouble(colData[fl_col_seq[ins_col_count]]));
+                       } else {
+                               stmt_ins.setNull(ins_col_count+1,java.sql.Types.FLOAT);
+                       }
+               } else if (CmnUtils.isColBytes(colTypeName[tb_col_seq[ins_col_count]])){
+                       if (!colData[fl_col_seq[ins_col_count]].equals("")){
+                               stmt_ins.setBytes(ins_col_count+1,CmnUtils.base64ToBytes(colData[fl_col_seq[ins_col_count]]));
+                       } else {
+                               stmt_ins.setBytes(ins_col_count+1,null);
+                       }
+               } else if (CmnUtils.isColBlob(colTypeName[tb_col_seq[ins_col_count]])){
+                       if (!colData[fl_col_seq[ins_col_count]].equals("")){
+                               stmt_ins.setBytes(ins_col_count+1,CmnUtils.base64ToBytes(colData[fl_col_seq[ins_col_count]]));
+                       } else {
+                               stmt_ins.setBlob(ins_col_count+1,null,0);
+                       }
+               } else if (CmnUtils.isColClob(colTypeName[tb_col_seq[ins_col_count]])){
+                       if (!colData[fl_col_seq[ins_col_count]].equals("")){
+                               stmt_ins.setString(ins_col_count+1,colData[fl_col_seq[ins_col_count]]);
+                       } else {
+                               stmt_ins.setClob(ins_col_count+1,null,0);
+                       }
+               } else {
+                       throw new Exception("\83J\83\89\83\80\82Ì\83f\81[\83^\8c^\82ª\91Î\8fÛ\8aO\82Å\82·\81B[" + colTypeName[tb_col_seq[ins_col_count]] + "]");
+               }
        }
 
        public void disconnect() throws Exception{
index 704f40e..e25c582 100644 (file)
@@ -81,11 +81,14 @@ public class RapideLoader{
                ArrayList<Boolean> alColMask    = null;
                ArrayList<Boolean> alColIncl    = null;
 
+               int [] tb_col_seq                               = null;
+               int [] fl_col_seq                               = null;
                int tb_count                                    = 0;
                int tb_col_count                                = 0;
                int fl_col_count                                = 0;
                boolean isLob                                   = false;
-               boolean isContinue                              = false;
+               boolean isContinue                              = true;
+               boolean isEqual                                 = false;
                CmnProperty cp = null;
                DataAccessObjects dao = null;
 
@@ -114,6 +117,7 @@ public class RapideLoader{
                        int fl_rec_count = 0;
                        int ins_rec_count = 0;
                        int tb_fl_match_count = 0;
+                       int inline_col_count = 0;
                        File [] inFiles = folder.listFiles();
                        if(inFiles != null) {
                                for(int k=0;k<inFiles.length;k++){
@@ -146,16 +150,17 @@ public class RapideLoader{
                                                        colTypeName = (String[])alColTypeName.toArray(new String[0]);
                                                        isNullable = (Integer[])alIsNullable.toArray(new Integer[0]);
                                                        tb_col_count = dao.getColumnCount();
-                                                       int [] tb_col_seq = new int[tb_col_count];
-                                                       int [] fl_col_seq = null;
+                                                       tb_col_seq = new int[tb_col_count];
+                                                       fl_col_seq = null;
                                                        dao.closeRecordSet();
                                                        tb_rec_count = 0;
                                                        fl_rec_count = 0;
                                                        ins_rec_count = 0;
                                                        fl_col_count = 0;
                                                        tb_fl_match_count = 0;
+                                                       inline_col_count = 0;
                                                        strMltLine = "";
-                                                       isContinue = false;
+                                                       isContinue = true;
                                                        isLob = false;
                                                        for(int j=0;j<colTypeName.length;j++)if(CmnUtils.isLob(colTypeName[j]))isLob = true;
                                                        CmnUtils.debugPrint("LOB="+isLob);
@@ -203,7 +208,7 @@ public class RapideLoader{
                                                                        }
 
                                                                        colIncl = (Boolean[])alColIncl.toArray(new Boolean[0]);
-                                                                       sql_insert = "INSERT INTO " + tbName + "(";
+                                                                       sql_insert = "INSERT INTO " + cp.sqlQuoted + tbName + cp.sqlQuoted + "(";
                                                                        for(int j=0;j<colData.length;j++){
                                                                                for(int l=0;l<tb_col_count;l++){
                                                                                        if(colName[l].equals(colData[j].replaceAll("\"",""))){
@@ -237,7 +242,7 @@ public class RapideLoader{
                                                                                CmnUtils.infoPrinting(String.format("%1$-30s",tbName));
                                                                        } else {
                                                                                dao.rollback();
-                                                                               CmnUtils.debugPrint("\8ew\92è\82µ\82½\8bæ\90Ø\82è\95\8e\9a\82Å\82Ì\83J\83\89\83\80\90\94\82ª0\82Å\82·\81B");
+                                                                               CmnUtils.infoPrint("\8ew\92è\82µ\82½\8bæ\90Ø\82è\95\8e\9a\82Å\82Ì\83J\83\89\83\80\90\94\82ª0\82Å\82·\81B\83X\83L\83b\83v\82µ\82Ü\82·\81B");
                                                                                if(br != null){
                                                                                        br.close();
                                                                                        br=null;
@@ -249,42 +254,22 @@ public class RapideLoader{
                                                                                break TABLE_LOOP;
                                                                        }
                                                                } else {
-                                                                       if(cp.isQuotation){
-                                                                               colData = CmnUtils.split(strLine,"\"" + cp.delimiter + "\"");
-                                                                       } else {
-                                                                               colData = CmnUtils.split(strLine,cp.delimiter);
-                                                                       }
-                                                                       if(colData.length == fl_col_count){
-                                                                               if(!strMltLine.equals("")){
-                                                                                       dao.rollback();
-                                                                                       CmnUtils.errorPrint("\8aY\93\96\83\8c\83R\81[\83h\82Ì\83J\83\89\83\80\90\94\82ª\83A\83\93\83}\83b\83`\82Å\82·\81B[" + tb_rec_count + "]");
-                                                                                       CmnUtils.debugPrint("************Record End");
-                                                                                       if(br != null){
-                                                                                               br.close();
-                                                                                               br=null;
-                                                                                       }
-                                                                                       if(stmt_ins != null){
-                                                                                               stmt_ins.close();
-                                                                                               stmt_ins=null;
-                                                                                       }
-                                                                                       break TABLE_LOOP;
+                                                                       if(!strMltLine.equals("")){
+                                                                               if(cp.isQuotation){
+                                                                                       inline_col_count = CmnUtils.split(strMltLine + cp.inColLineSeparator + strLine,"\"" + cp.delimiter + "\"").length;
                                                                                } else {
-                                                                                       isContinue = false;
+                                                                                       inline_col_count = CmnUtils.split(strMltLine + cp.inColLineSeparator + strLine,cp.delimiter).length;
                                                                                }
-                                                                       } else {
-                                                                               if (strMltLine.equals("")){
-                                                                                       strMltLine += strLine;
-                                                                                       isContinue = true;
-                                                                               } else {
-                                                                                       strMltLine += cp.inColLineSeparator + strLine;
-                                                                                       if(cp.isQuotation){
-                                                                                               colData = CmnUtils.split(strMltLine,"\"" + cp.delimiter + "\"");
-                                                                                       } else {
-                                                                                               colData = CmnUtils.split(strMltLine,cp.delimiter);
-                                                                                       }
-                                                                                       if(colData.length == fl_col_count){
+                                                                               CmnUtils.debugPrint("length=" + inline_col_count);
+                                                                               if(inline_col_count > fl_col_count){
+                                                                                       if(isEqual){
                                                                                                isContinue = false;
-                                                                                       } else if(colData.length >fl_col_count){
+                                                                                               if(cp.isQuotation){
+                                                                                                       colData = CmnUtils.split(strMltLine.substring(1,strMltLine.length()-1),"\"" + cp.delimiter + "\"");
+                                                                                               } else {
+                                                                                                       colData = CmnUtils.split(strMltLine,cp.delimiter);
+                                                                                               }
+                                                                                       } else {
                                                                                                dao.rollback();
                                                                                                CmnUtils.errorPrint("\8aY\93\96\83\8c\83R\81[\83h\82Ì\83J\83\89\83\80\90\94\82ª\83A\83\93\83}\83b\83`\82Å\82·\81B[" + tb_rec_count + "]");
                                                                                                CmnUtils.debugPrint("************Record End");
@@ -297,175 +282,51 @@ public class RapideLoader{
                                                                                                        stmt_ins=null;
                                                                                                }
                                                                                                break TABLE_LOOP;
-                                                                                       } else {
-                                                                                               isContinue = true;
                                                                                        }
+                                                                               } else if(inline_col_count == fl_col_count){
+                                                                                       strMltLine += cp.inColLineSeparator + strLine;
+                                                                                       CmnUtils.debugPrint("strMltLine(eq)=" + strMltLine);
+                                                                                       isEqual = true;
+                                                                                       
+                                                                               } else {
+                                                                                       strMltLine += cp.inColLineSeparator + strLine;
+                                                                                       CmnUtils.debugPrint("strMltLine(le)=" + strMltLine);
+                                                                               }
+                                                                       } else {
+                                                                               if(cp.isQuotation){
+                                                                                       inline_col_count = CmnUtils.split(strLine,"\"" + cp.delimiter + "\"").length;
+                                                                               } else {
+                                                                                       inline_col_count = CmnUtils.split(strLine,cp.delimiter).length;
+                                                                               }
+                                                                               strMltLine = strLine;
+                                                                               CmnUtils.debugPrint("strMltLine(1)=" + strMltLine);
+                                                                               if(inline_col_count == fl_col_count){
+                                                                                       isEqual = true;
                                                                                }
                                                                        }
                                                                        if(isContinue == false){
+                                                                               CmnUtils.debugPrint("strMltLine(w)=" + strMltLine);
                                                                                for(int j=0;j<ins_rec_count;j++){
-                                                                                       if(j==0){
-                                                                                               if(cp.isQuotation){
-                                                                                                       if(colData[fl_col_seq[j]].length()>1){
-                                                                                                               colData[fl_col_seq[j]]=colData[fl_col_seq[j]].substring(1,colData[fl_col_seq[j]].length());
-                                                                                                       } else {
-                                                                                                               colData[fl_col_seq[j]]=colData[fl_col_seq[j]].substring(1,colData[fl_col_seq[j]].length()).replaceAll("\"","");
-                                                                                                       }
-                                                                                               }
-                                                                                       }
-                                                                                       if(j==ins_rec_count-1){
-                                                                                               if(cp.isQuotation){
-                                                                                                       if(colData[fl_col_seq[j]].length()>1){
-                                                                                                               colData[fl_col_seq[j]]=colData[fl_col_seq[j]].substring(0,colData[fl_col_seq[j]].length()-1);
-                                                                                                       } else {
-                                                                                                               colData[fl_col_seq[j]]=colData[fl_col_seq[j]].substring(0,colData[fl_col_seq[j]].length()).replaceAll("\"","");
-                                                                                                       }
-                                                                                               }
-                                                                                       }
-                                                                                       
                                                                                        CmnUtils.deepPrint("[" + fl_rec_count + "]" + "[" + j + "]" + colName[tb_col_seq[j]].toUpperCase() + "." + colTypeName[tb_col_seq[j]] + "='" + colData[fl_col_seq[j]] + "'");
-                                                                                       if (CmnUtils.isColString(colTypeName[tb_col_seq[j]])){
-                                                                                               if(cp.isMask){
-                                                                                                       if(
-                                                                                                               (cp.isInclColsMask &&
-                                                                                                                !cp.isExclColsMask && 
-                                                                                                                CmnUtils.isMatch(cp.inclColsMaskArray,tbName.toUpperCase(), colName[tb_col_seq[j]].toUpperCase())
-                                                                                                               ) ||
-                                                                                                               (cp.isInclColsMask &&
-                                                                                                                cp.isExclColsMask && 
-                                                                                                                CmnUtils.isMatch(cp.inclColsMaskArray,tbName.toUpperCase(), colName[tb_col_seq[j]].toUpperCase()) &&
-                                                                                                                !CmnUtils.isMatch(cp.exclColsMaskArray,tbName.toUpperCase(),colName[tb_col_seq[j]].toUpperCase())
-                                                                                                               ) ||
-                                                                                                               (!cp.isInclColsMask &&
-                                                                                                                cp.isExclColsMask && 
-                                                                                                                !CmnUtils.isMatch(cp.exclColsMaskArray,tbName.toUpperCase(),colName[tb_col_seq[j]].toUpperCase())
-                                                                                                               )
-                                                                                                       ){
-                                                                                                               StringBuffer sb = new StringBuffer();
-                                                                                                               for(int l=0;l<colData[fl_col_seq[j]].length();l++){
-                                                                                                                       if((cp.maskPattern.toUpperCase().equals(cp.MASK_PTN[cp.MASK_PTN_ALT]) && 
-                                                                                                                                       (l % 2) == 1) || 
-                                                                                                                          (cp.maskPattern.toUpperCase().equals(cp.MASK_PTN[cp.MASK_PTN_EDGE]) && 
-                                                                                                                                       !(l == 0 || j == colData[fl_col_seq[j]].length() - 1) ||
-                                                                                                                          (cp.maskPattern.toUpperCase().equals(cp.MASK_PTN[cp.MASK_PTN_ALL]))
-                                                                                                                          )
-                                                                                                                       ){
-                                                                                                                               if(CmnUtils.isHankaku(colData[fl_col_seq[j]].charAt(l))){
-                                                                                                                                       sb.append(cp.singleByteMaskChar);
-                                                                                                                               } else {
-                                                                                                                                       sb.append(cp.doubleByteMaskChar);
-                                                                                                                               }
-                                                                                                                       } else {
-                                                                                                                               sb.append(colData[fl_col_seq[j]].charAt(l));
-                                                                                                                       }
-                                                                                                               }
-                                                                                                               colData[fl_col_seq[j]] = sb.toString();
-                                                                                                       }
-                                                                                               }
-                                                                                               if (!colData[fl_col_seq[j]].equals("")){
-                                                                                                       if(cp.isQuotation){
-                                                                                                               stmt_ins.setString(j+1,colData[fl_col_seq[j]].replaceAll("\"\"","\""));
-                                                                                                       } else {
-                                                                                                               stmt_ins.setString(j+1,colData[fl_col_seq[j]]);
-                                                                                                       }
-                                                                                               } else {
-                                                                                                       if(isNullable[j] == 0){
-                                                                                                               stmt_ins.setString(j+1," ");
-                                                                                                       } else {
-                                                                                                               stmt_ins.setString(j+1,null);
-                                                                                                       }
-                                                                                               }
-                                                                                       } else if (CmnUtils.isColDate(colTypeName[tb_col_seq[j]])){
-                                                                                               if (!colData[fl_col_seq[j]].equals("")){
-                                                                                                       stmt_ins.setDate(j+1,java.sql.Date.valueOf(colData[fl_col_seq[j]]));
-                                                                                               } else {
-                                                                                                       stmt_ins.setDate(j+1,null);
-                                                                                               }
-                                                                                       } else if (CmnUtils.isColYear(colTypeName[tb_col_seq[j]])){
-                                                                                               if (!colData[fl_col_seq[j]].equals("")){
-                                                                                                       stmt_ins.setString(j+1,colData[fl_col_seq[j]]);
-                                                                                               } else {
-                                                                                                       stmt_ins.setDate(j+1,null);
-                                                                                               }
-                                                                                       } else if (CmnUtils.isColTime(colTypeName[tb_col_seq[j]])){
-                                                                                               if (!colData[fl_col_seq[j]].equals("")){
-                                                                                                       stmt_ins.setTime(j+1,java.sql.Time.valueOf(colData[fl_col_seq[j]]));
-                                                                                               } else {
-                                                                                                       stmt_ins.setTime(j+1,null);
-                                                                                               }
-                                                                                       } else if (CmnUtils.isColTimestamp(colTypeName[tb_col_seq[j]])){
-                                                                                               if (!colData[fl_col_seq[j]].equals("")){
-                                                                                                       stmt_ins.setTimestamp(j+1,java.sql.Timestamp.valueOf(colData[fl_col_seq[j]]));
-                                                                                                       //CmnUtils.debugPrint("Timestamp=" + colData[fl_col_seq[j]]);
-                                                                                               } else {
-                                                                                                       stmt_ins.setTimestamp(j+1,null);
-                                                                                               }
-                                                                                       } else if (CmnUtils.isColBigDecimal(colTypeName[tb_col_seq[j]])){
-                                                                                               if (!colData[fl_col_seq[j]].equals("")){
-                                                                                                       stmt_ins.setBigDecimal(j+1,new BigDecimal(colData[fl_col_seq[j]]));
-                                                                                               } else {
-                                                                                                       stmt_ins.setNull(j+1,java.sql.Types.DECIMAL);
-                                                                                               }
-                                                                                       } else if (CmnUtils.isColShort(colTypeName[tb_col_seq[j]])){
-                                                                                               if (!colData[fl_col_seq[j]].equals("")){
-                                                                                                       stmt_ins.setShort(j+1,Short.parseShort(colData[fl_col_seq[j]]));
-                                                                                               } else {
-                                                                                                       stmt_ins.setNull(j+1,java.sql.Types.SMALLINT);
-                                                                                               }
-                                                                                       } else if (CmnUtils.isColInt(colTypeName[tb_col_seq[j]])){
-                                                                                               if (!colData[fl_col_seq[j]].equals("")){
-                                                                                                       stmt_ins.setInt(j+1,Integer.parseInt(colData[fl_col_seq[j]]));
-                                                                                               } else {
-                                                                                                       stmt_ins.setNull(j+1,java.sql.Types.INTEGER);
-                                                                                               }
-                                                                                       } else if (CmnUtils.isColLong(colTypeName[tb_col_seq[j]])){
-                                                                                               if (!colData[fl_col_seq[j]].equals("")){
-                                                                                                       stmt_ins.setLong(j+1,Long.parseLong(colData[fl_col_seq[j]]));
-                                                                                               } else {
-                                                                                                       stmt_ins.setNull(j+1,java.sql.Types.BIGINT);
-                                                                                               }
-                                                                                       } else if (CmnUtils.isColFloat(colTypeName[tb_col_seq[j]])){
-                                                                                               if (!colData[fl_col_seq[j]].equals("")){
-                                                                                                       stmt_ins.setFloat(j+1,Float.parseFloat(colData[fl_col_seq[j]]));
-                                                                                               } else {
-                                                                                                       stmt_ins.setNull(j+1,java.sql.Types.REAL);
-                                                                                               }
-                                                                                       } else if (CmnUtils.isColDouble(colTypeName[tb_col_seq[j]])){
-                                                                                               if (!colData[fl_col_seq[j]].equals("")){
-                                                                                                       stmt_ins.setDouble(j+1,Double.parseDouble(colData[fl_col_seq[j]]));
-                                                                                               } else {
-                                                                                                       stmt_ins.setNull(j+1,java.sql.Types.FLOAT);
-                                                                                               }
-                                                                                       } else if (CmnUtils.isColBytes(colTypeName[tb_col_seq[j]])){
-                                                                                               if (!colData[fl_col_seq[j]].equals("")){
-                                                                                                       stmt_ins.setBytes(j+1,CmnUtils.base64ToBytes(colData[fl_col_seq[j]]));
-                                                                                               } else {
-                                                                                                       stmt_ins.setBytes(j+1,null);
-                                                                                               }
-                                                                                       } else if (CmnUtils.isColBlob(colTypeName[tb_col_seq[j]])){
-                                                                                               if (!colData[fl_col_seq[j]].equals("")){
-                                                                                                       stmt_ins.setBytes(j+1,CmnUtils.base64ToBytes(colData[fl_col_seq[j]]));
-                                                                                               } else {
-                                                                                                       stmt_ins.setBlob(j+1,null,0);
-                                                                                               }
-                                                                                       } else if (CmnUtils.isColClob(colTypeName[tb_col_seq[j]])){
-                                                                                               if (!colData[fl_col_seq[j]].equals("")){
-                                                                                                       stmt_ins.setString(j+1,colData[fl_col_seq[j]]);
-                                                                                               } else {
-                                                                                                       stmt_ins.setClob(j+1,null,0);
-                                                                                               }
-                                                                                       } else {
-                                                                                               CmnUtils.errorPrint("\83J\83\89\83\80\82Ì\83f\81[\83^\8c^\82ª\91Î\8fÛ\8aO\82Å\82·\81B[" + colTypeName[tb_col_seq[j]] + "]");
-                                                                                               break TABLE_LOOP;
-                                                                                       }
+                                                                                       dao.setColString(stmt_ins, colData, j, tb_col_seq, fl_col_seq);
                                                                                }
                                                                                if(isLob){
                                                                                        stmt_ins.executeUpdate();
                                                                                } else {
                                                                                        stmt_ins.addBatch();
                                                                                }
-                                                                               strMltLine = "";
+                                                                               strMltLine = strLine;
                                                                                tb_rec_count++;
+                                                                               isContinue = true;
+                                                                               isEqual = false;
+                                                                               if(cp.isQuotation){
+                                                                                       inline_col_count = CmnUtils.split(strLine,"\"" + cp.delimiter + "\"").length;
+                                                                               } else {
+                                                                                       inline_col_count = CmnUtils.split(strLine,cp.delimiter).length;
+                                                                               }
+                                                                               if(inline_col_count == fl_col_count){
+                                                                                       isEqual = true;
+                                                                               }
                                                                        }
                                                                }
                                                                fl_rec_count++;
@@ -474,6 +335,54 @@ public class RapideLoader{
                                                                        CmnUtils.debugPrint("insert record=" + fl_rec_count);
                                                                }
                                                        }
+                                                       
+                                                       if(!strMltLine.equals("")){
+                                                               if(cp.isQuotation){
+                                                                       inline_col_count = CmnUtils.split(strMltLine,"\"" + cp.delimiter + "\"").length;
+                                                               } else {
+                                                                       inline_col_count = CmnUtils.split(strMltLine,cp.delimiter).length;
+                                                               }
+                                                               if(inline_col_count == fl_col_count){
+                                                                       isContinue = false;
+                                                                       if(cp.isQuotation){
+                                                                               colData = CmnUtils.split(strMltLine.substring(1,strMltLine.length()-1),"\"" + cp.delimiter + "\"");
+                                                                       } else {
+                                                                               colData = CmnUtils.split(strMltLine,cp.delimiter);
+                                                                       }
+                                                               } else {
+                                                                       dao.rollback();
+                                                                       CmnUtils.errorPrint("\8aY\93\96\83\8c\83R\81[\83h\82Ì\83J\83\89\83\80\90\94\82ª\83A\83\93\83}\83b\83`\82Å\82·\81B[" + tb_rec_count + "]");
+                                                                       CmnUtils.debugPrint("************Record End");
+                                                                       if(br != null){
+                                                                               br.close();
+                                                                               br=null;
+                                                                       }
+                                                                       if(stmt_ins != null){
+                                                                               stmt_ins.close();
+                                                                               stmt_ins=null;
+                                                                       }
+                                                                       break TABLE_LOOP;
+                                                               }
+                                                       }
+                                                       if(isContinue == false){
+                                                               for(int j=0;j<ins_rec_count;j++){
+                                                                       CmnUtils.deepPrint("[" + fl_rec_count + "]" + "[" + j + "]" + colName[tb_col_seq[j]].toUpperCase() + "." + colTypeName[tb_col_seq[j]] + "='" + colData[fl_col_seq[j]] + "'");
+                                                                       dao.setColString(stmt_ins, colData, j, tb_col_seq, fl_col_seq);
+                                                               }
+                                                               if(isLob){
+                                                                       stmt_ins.executeUpdate();
+                                                               } else {
+                                                                       stmt_ins.addBatch();
+                                                               }
+                                                               tb_rec_count++;
+                                                       }
+
+                                                       if (tb_rec_count % cp.batchCount == 0){
+                                                               if(!isLob)stmt_ins.executeBatch();
+                                                               CmnUtils.debugPrint("insert record=" + tb_rec_count);
+                                                       }
+                                                       
+                                                       
                                                        CmnUtils.debugPrint("sql_insert=" + sql_insert);
                                                        if(!isLob)stmt_ins.executeBatch();
                                                        dao.commit();
@@ -497,6 +406,14 @@ public class RapideLoader{
 
                        CmnUtils.infoPrint("\83f\81[\83^\83\8d\81[\83h\82ð\8fI\97¹\82µ\82Ü\82µ\82½\81B");
 
+               } catch(SQLException se) {
+                       try{
+                               CmnUtils.errorPrint(se.toString());
+                               while (se != null) {
+                                 System.out.println("Error Message: " + se.getMessage());
+                                 se = se.getNextException();
+                               }
+                       } catch (Exception see) {}
                } catch (Exception e) {
                        try{
                                CmnUtils.errorPrint(e.toString());