1 19 20 package org.webdocwf.util.loader; 21 22 import java.util.*; 23 import java.sql.*; 24 25 31 public class QueryRelationSet { 32 33 private String strQueryRelations = ""; 34 private Vector indexDummyRelationNull= new Vector(); 35 private Vector indexDummyRelationOver= new Vector(); 36 private Vector vecTempRelationSourceType=new Vector(); 37 private String tableName=null; 38 private String tableID=null; 39 40 54 public QueryRelationSet(int iRelationColumns, Vector vecRelationColumnSourceTableName, 55 Vector vecRelationColumnSourceTableID, Vector vecVariableUseIDTableName, 56 Vector vecVariableUseIDTableID, Vector vecRelationColumnSourceColumnName, 57 int iTargetFirstColumnResult, Statement stmtTarget, String tableID, 58 Vector vecRelationColumnTargetTableID, String tableName) { 59 60 ResultSet rsetTarget; 61 this.tableName=tableName; 62 this.tableID=tableID; 63 for (int i = 0; i < iRelationColumns; i++) { 64 outLoop: if (vecRelationColumnSourceTableName.get(i).toString().equalsIgnoreCase(tableName) 65 && vecRelationColumnSourceTableID.get(i).toString().equalsIgnoreCase(tableID)) { 66 for (int m = 0; m < vecVariableUseIDTableName.size(); m++) { 67 if (vecRelationColumnSourceTableName.get(i).toString().equalsIgnoreCase(vecVariableUseIDTableName.get(m).toString()) 68 && vecRelationColumnSourceTableID.get(i).toString().equalsIgnoreCase(vecVariableUseIDTableID.get(m).toString())) { 69 String strQueryRelations = "select " 70 + vecRelationColumnSourceColumnName.get(i).toString() 71 + " from " + vecRelationColumnSourceTableName.get(i).toString(); 72 try{ 73 rsetTarget = stmtTarget.executeQuery(strQueryRelations); 74 rsetTarget.next(); 75 if (iTargetFirstColumnResult ==1) { 76 this.vecTempRelationSourceType.add(rsetTarget.getMetaData().getColumnTypeName(1)); 77 }else { 78 this.vecTempRelationSourceType.add(rsetTarget.getMetaData().getColumnTypeName(0)); 79 } 80 rsetTarget.close(); 81 break outLoop; 82 }catch(Exception e){ 83 e.getMessage(); 84 } 85 } 86 } 87 String strQueryRelations = "select " + vecRelationColumnSourceColumnName.get(i).toString() 88 + " from " + vecRelationColumnSourceTableName.get(i).toString(); 89 try{ 90 rsetTarget = stmtTarget.executeQuery(strQueryRelations); 91 rsetTarget.next(); 92 if (iTargetFirstColumnResult == 1) { 93 vecTempRelationSourceType.add(rsetTarget.getMetaData().getColumnTypeName(1)); 94 } 95 else { 96 vecTempRelationSourceType.add(rsetTarget.getMetaData().getColumnTypeName(0)); 97 rsetTarget.next(); 98 } 99 }catch(Exception e){ 100 e.getMessage(); 101 } 102 } 103 } 104 } 105 106 110 public Vector getRelationSourceType(){ 111 return vecTempRelationSourceType; 112 } 113 114 115 119 public String getQueryRelations(){ 120 return strQueryRelations; 121 } 122 123 127 public Vector getIndexDummyRelationNull(){ 128 return indexDummyRelationNull; 129 } 130 131 135 public Vector getIndexDummyRelationOver(){ 136 return indexDummyRelationOver; 137 } 138 139 } | Popular Tags |