version 1.1, 2003/12/05 11:46:39
|
version 1.6, 2004/01/28 12:22:35
|
Line 1
|
Line 1
|
import java.io.ByteArrayOutputStream; |
|
import java.io.PrintStream; |
|
import java.sql.*; |
import java.sql.*; |
import java.util.*; |
import java.util.*; |
import com.fmi.jdbc.*; |
import com.fmi.jdbc.*; |
Line 53 public class DBBean
|
Line 53 public class DBBean
|
String url = ""; |
String url = ""; |
DatabaseMetaData dbMetaData; |
DatabaseMetaData dbMetaData; |
Vector columnNames; |
Vector columnNames; |
|
Vector ids = new Vector(); |
String user = (System.getProperty("user.name") == null) ? "" : System.getProperty("user.name"); //"postgres"; |
String user = (System.getProperty("user.name") == null) ? "" : System.getProperty("user.name"); //"postgres"; |
String passwd = ""; //"3333";//"rogo"; |
String passwd = ""; //"3333";//"rogo"; |
public int maxHits = 10; |
public int maxHits = 10; |
Line 194 public class DBBean
|
Line 195 public class DBBean
|
quoteChar = "\""; // needed for postgres |
quoteChar = "\""; // needed for postgres |
} |
} |
|
|
|
public void setIDVector(Vector ids) |
|
{ |
|
this.ids = ids; |
|
} |
|
|
|
/** |
|
* returns a Vector containing the ID Row Name |
|
**/ |
|
public Vector getIDVector() |
|
{ |
|
return ids; |
|
} |
/** |
/** |
* returns a Vector containing the Tablenames or an error message in the Vector |
* returns a Vector containing the Tablenames or an error message in the Vector |
*/ |
*/ |
Line 633 public class DBBean
|
Line 646 public class DBBean
|
{ |
{ |
result = null; |
result = null; |
Statement stm = null; |
Statement stm = null; |
|
|
// System.out.println("Query " + query); |
// System.out.println("Query " + query); |
|
|
if (!connection.isClosed()) |
if (!connection.isClosed()) |
stm = connection.createStatement(); |
stm = connection.createStatement(); |
stm.setMaxRows(numberOfHits); |
stm.setMaxRows(numberOfHits); |
result = stm.executeQuery(query); |
long time = System.currentTimeMillis(); |
// System.out.println(result+" "+stm.getMoreResults()); |
stm.execute(query); |
|
long time2 = System.currentTimeMillis(); |
|
|
|
System.out.println("time to execute "+(time2-time)); |
|
// stm.setMaxRows(numberOfHits); |
|
|
|
result = stm.getResultSet(); |
|
// System.out.println(result+" "+stm.getUpdateCount()); |
metaData = result.getMetaData(); |
metaData = result.getMetaData(); |
return result; |
return result; |
} |
} |
Line 1335 public class DBBean
|
Line 1356 public class DBBean
|
resultSet.next(); |
resultSet.next(); |
return resultSet.getInt(1); |
return resultSet.getInt(1); |
} |
} |
|
public TreeSet getIDVector(String id,String table) throws Exception |
|
{ |
|
TreeSet t= new TreeSet(); |
|
getConnection(); |
|
ResultSet result = this.result; |
|
makeQuery("select "+id+" from "+getQC()+table+getQC(),0 ); |
|
while(true) |
|
{ |
|
Vector vec = getNextRow(); |
|
if (vec == null) |
|
break; |
|
t.add(vec.get(0)); |
|
} |
|
this.result=result; |
|
metaData = this.result.getMetaData(); |
|
return t; |
|
} |
|
|
} |
} |