📄 queryrelationset.java
字号:
/**
Copyright (C) 2002-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.*;
/**
* Class used while building relations in target tables
*
* @author Radoslav Dutina
* @version 1.1
*/
public class QueryRelationSet {
private String strQueryRelations = "";
private Vector indexDummyRelationNull= new Vector();
private Vector indexDummyRelationOver= new Vector();
private Vector vecTempRelationSourceType=new Vector();
private String tableName=null;
private String tableID=null;
/**
* Construct object of QueryRelationSet class with an associated parameters.
* @param iRelationColumns defines number of relation column
* @param vecRelationColumnSourceTableName defines source table name for relations
* @param vecRelationColumnSourceTableID defines source table ID for relations
* @param vecVariableUseIDTableName defines variable ID name
* @param vecVariableUseIDTableID defines variable ID
* @param vecRelationColumnSourceColumnName defines cource column names for relations
* @param iTargetFirstColumnResult defines parameter of ResultSet object
* @param stmtTarget defines statement object for target table
* @param tableID is table ID
* @param vecRelationColumnTargetTableID defines target table ID for relations
* @param tableName is name of the current table
*/
public QueryRelationSet(int iRelationColumns, Vector vecRelationColumnSourceTableName,
Vector vecRelationColumnSourceTableID, Vector vecVariableUseIDTableName,
Vector vecVariableUseIDTableID, Vector vecRelationColumnSourceColumnName,
int iTargetFirstColumnResult, Statement stmtTarget, String tableID,
Vector vecRelationColumnTargetTableID, String tableName) {
ResultSet rsetTarget;
this.tableName=tableName;
this.tableID=tableID;
for (int i = 0; i < iRelationColumns; i++) {
outLoop: if (vecRelationColumnSourceTableName.get(i).toString().equalsIgnoreCase(tableName)
&& vecRelationColumnSourceTableID.get(i).toString().equalsIgnoreCase(tableID)) {
for (int m = 0; m < vecVariableUseIDTableName.size(); m++) {
if (vecRelationColumnSourceTableName.get(i).toString().equalsIgnoreCase(vecVariableUseIDTableName.get(m).toString())
&& vecRelationColumnSourceTableID.get(i).toString().equalsIgnoreCase(vecVariableUseIDTableID.get(m).toString())) {
String strQueryRelations = "select "
+ vecRelationColumnSourceColumnName.get(i).toString()
+ " from " + vecRelationColumnSourceTableName.get(i).toString();
try{
rsetTarget = stmtTarget.executeQuery(strQueryRelations);
rsetTarget.next();
if (iTargetFirstColumnResult ==1) {
this.vecTempRelationSourceType.add(rsetTarget.getMetaData().getColumnTypeName(1));
}else {
this.vecTempRelationSourceType.add(rsetTarget.getMetaData().getColumnTypeName(0));
}
rsetTarget.close();
break outLoop;
}catch(Exception e){
e.getMessage();
}
}
}
String strQueryRelations = "select " + vecRelationColumnSourceColumnName.get(i).toString()
+ " from " + vecRelationColumnSourceTableName.get(i).toString();
try{
rsetTarget = stmtTarget.executeQuery(strQueryRelations);
rsetTarget.next();
if (iTargetFirstColumnResult == 1) {
vecTempRelationSourceType.add(rsetTarget.getMetaData().getColumnTypeName(1));
}
else {
vecTempRelationSourceType.add(rsetTarget.getMetaData().getColumnTypeName(0));
rsetTarget.next();
}
}catch(Exception e){
e.getMessage();
}
}
}
}
/**
* This method read value of vecTempRelationSourceType parameter
* @return value of parameter
*/
public Vector getRelationSourceType(){
return vecTempRelationSourceType;
}
/**
* This method read value of strQueryRelations parameter
* @return value of parameter
*/
public String getQueryRelations(){
return strQueryRelations;
}
/**
* This method read value of indexDummyRelationNull parameter
* @return value of parameter
*/
public Vector getIndexDummyRelationNull(){
return indexDummyRelationNull;
}
/**
* This method read value of indexDummyRelationOver parameter
* @return value of parameter
*/
public Vector getIndexDummyRelationOver(){
return indexDummyRelationOver;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -