📄 queryconstantset.java
字号:
/*
LoaderGenerator - tool for generated xml, sql and doml file needed for Octopus.
Copyright (C) 2003 Together
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.webdocwf.util.loader;
import java.util.*;
import java.sql.*;
/**
*
* QueryConstantSet class sets the query statement for constant columns
* @author unascribed
* @version 1.0
*/
public class QueryConstantSet {
private String strQueryConstant=null;
private Vector indexDummyOverwrite=new Vector();
private Vector indexDummyNull=new Vector();
/**
* Construct object QueryConstantSet class with associated parameters
* @param tableName current table name
* @param vecConstantColumns vector of constant column names
* @param vecConstantMode vector of constant column modes
* @param vecConstantType vector of constant column types
*/
public QueryConstantSet(String tableName,Vector vecConstantColumns,
Vector vecConstantMode, Vector vecConstantType, ConfigReader configReaderTarget) throws LoaderException{
strQueryConstant="update "+ tableName+ " set ";
for(int i=0;i<vecConstantColumns.size();i++){
if(vecConstantMode.get(i).toString().equalsIgnoreCase("Overwrite")){
//ZK change this 7.5 2004 from CheckType to configReaderTarget
try {
if(!configReaderTarget.isNumber(vecConstantType.get(i).toString())){
strQueryConstant += vecConstantColumns.get(i).toString()
+ " = " + "'dummyConstantOver'"+", ";
}else{
strQueryConstant += vecConstantColumns.get(i).toString()
+ " = " + "dummyConstantOver"+", ";
}
} catch (LoaderException e) {
LoaderException le = new LoaderException("Exception:Type not present in conf file for target database, add it into conf file.",(Throwable)e);
throw le;
}
indexDummyOverwrite.add(String.valueOf(i));
}else if(vecConstantMode.get(i).toString().equalsIgnoreCase("Update")||
vecConstantMode.get(i).toString().equalsIgnoreCase("SetNull")){
//ZK change this 7.5 2004 from CheckType to configReaderTarget
try {
if(!configReaderTarget.isNumber(vecConstantType.get(i).toString())){
strQueryConstant += vecConstantColumns.get(i).toString()
+ " = " + "'dummyConstantNull'"+", ";
}else{
strQueryConstant += vecConstantColumns.get(i).toString()
+ " = " + "dummyConstantNull"+", ";
}
} catch (LoaderException e) {
LoaderException le = new LoaderException("Exception:Type not present in conf file for target database, add it into conf file.",(Throwable)e);
throw le;
}
indexDummyNull.add(String.valueOf(i));
}
}
}
/**
* This method read value of strQueryConstant parameter
* @return value of parameter
*/
public String getQueryConstant(){
return strQueryConstant;
}
/**
* This method read value from indexDummyOverwrite parameter
* @return value of parameter
*/
public Vector getIndexDummyOverwrite(){
return indexDummyOverwrite;
}
/**
* This method read value from indexDummyNull parameter
* @return value of parameter
*/
public Vector getIndexDummyNull(){
return indexDummyNull;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -