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;
+ " 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 "
+ " 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;
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{
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;
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++){
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);
}
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("\"",""))){
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;
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");
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++;
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();
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());