1 2 22 23 package org.webdocwf.util.loader; 24 25 import java.util.*; 26 import java.sql.*; 27 28 34 public class QueryConstantSet { 35 36 private String strQueryConstant=null; 37 private Vector indexDummyOverwrite=new Vector(); 38 private Vector indexDummyNull=new Vector(); 39 40 47 public QueryConstantSet(String tableName,Vector vecConstantColumns, 48 Vector vecConstantMode, Vector vecConstantType, ConfigReader configReaderTarget) throws LoaderException{ 49 50 strQueryConstant="update "+ tableName+ " set "; 51 for(int i=0;i<vecConstantColumns.size();i++){ 52 if(vecConstantMode.get(i).toString().equalsIgnoreCase("Overwrite")){ 53 try { 55 if(!configReaderTarget.isNumber(vecConstantType.get(i).toString())){ 56 strQueryConstant += vecConstantColumns.get(i).toString() 57 + " = " + "'dummyConstantOver'"+", "; 58 }else{ 59 strQueryConstant += vecConstantColumns.get(i).toString() 60 + " = " + "dummyConstantOver"+", "; 61 } 62 } catch (LoaderException e) { 63 LoaderException le = new LoaderException("Exception:Type not present in conf file for target database, add it into conf file.",(Throwable )e); 64 throw le; 65 } 66 indexDummyOverwrite.add(String.valueOf(i)); 67 }else if(vecConstantMode.get(i).toString().equalsIgnoreCase("Update")|| 68 vecConstantMode.get(i).toString().equalsIgnoreCase("SetNull")){ 69 try { 71 if(!configReaderTarget.isNumber(vecConstantType.get(i).toString())){ 72 strQueryConstant += vecConstantColumns.get(i).toString() 73 + " = " + "'dummyConstantNull'"+", "; 74 }else{ 75 strQueryConstant += vecConstantColumns.get(i).toString() 76 + " = " + "dummyConstantNull"+", "; 77 } 78 } catch (LoaderException e) { 79 LoaderException le = new LoaderException("Exception:Type not present in conf file for target database, add it into conf file.",(Throwable )e); 80 throw le; 81 } 82 indexDummyNull.add(String.valueOf(i)); 83 } 84 } 85 } 86 87 91 public String getQueryConstant(){ 92 return strQueryConstant; 93 } 94 95 99 public Vector getIndexDummyOverwrite(){ 100 return indexDummyOverwrite; 101 } 102 103 107 public Vector getIndexDummyNull(){ 108 return indexDummyNull; 109 } 110 111 112 113 114 } | Popular Tags |