version 1.27, 2004/07/09 10:26:38
|
version 1.36, 2004/10/19 11:12:19
|
Line 86 public class DBBean
|
Line 86 public class DBBean
|
DriverManager.registerDriver((Driver) Class.forName("org.postgresql.Driver").newInstance()); |
DriverManager.registerDriver((Driver) Class.forName("org.postgresql.Driver").newInstance()); |
DriverManager.registerDriver((Driver) Class.forName("com.mysql.jdbc.Driver").newInstance()); |
DriverManager.registerDriver((Driver) Class.forName("com.mysql.jdbc.Driver").newInstance()); |
DriverManager.registerDriver((Driver) Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance()); |
DriverManager.registerDriver((Driver) Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance()); |
|
DriverManager.registerDriver((Driver) Class.forName("com.ddtek.jdbc.sequelink.SequeLinkDriver").newInstance()); |
DriverManager.registerDriver((Driver) Class.forName("acs.jdbc.Driver").newInstance()); |
DriverManager.registerDriver((Driver) Class.forName("acs.jdbc.Driver").newInstance()); |
|
|
// wait a maximum of 10 seconds when attempting to establish a connection |
// wait a maximum of 10 seconds when attempting to establish a connection |
Line 612 public class DBBean
|
Line 613 public class DBBean
|
// container fields |
// container fields |
try |
try |
{ |
{ |
tableRow.addElement(new Double(resultSet.getDouble(i))); |
Double value =new Double(resultSet.getDouble(i)); |
m_columnClasses.addElement(Double.class); |
|
|
|
|
// tableRow.addElement(new Double(resultSet.getDouble(i))); |
|
String tVal =value.toString(); |
|
tVal = tVal.substring(tVal.indexOf('.')+1); |
|
boolean checkMe = tVal.length()==1&&tVal.equals("0"); |
|
// System.out.println("check was"+checkMe+" "+tVal); |
|
if(checkMe) |
|
tableRow.addElement(new Integer(value.intValue())); |
|
else |
|
tableRow.addElement(value); |
|
|
} catch (Exception e) |
} catch (Exception e) |
{ |
{ |
Line 642 public class DBBean
|
Line 653 public class DBBean
|
// if(resultSet.getObject(i)!=null) System.out.println(resultSet.getObject(i)); |
// if(resultSet.getObject(i)!=null) System.out.println(resultSet.getObject(i)); |
try |
try |
{ |
{ |
byte[] b = resultSet.getBytes(i); |
|
String utf8 = null; |
String utf8 = null; |
if (metaData instanceof ResultSetMetaDataExt) |
if (metaData instanceof ResultSetMetaDataExt) |
|
{ |
|
byte[] b = resultSet.getBytes(i); |
|
|
|
if (metaData instanceof ResultSetMetaDataExt) |
utf8 = (b == null) ? null : new String(b); |
utf8 = (b == null) ? null : new String(b); |
else |
else |
utf8 = (b == null) ? null : new String(b, "UTF-8"); |
utf8 = (b == null) ? null : new String(b, "UTF-8"); |
utf8 = (utf8 == null) ? null : new String(utf8.getBytes("UTF-8"), "UTF-8"); |
} |
|
else |
|
utf8=resultSet.getString(i); |
|
|
|
// utf8 = (utf8 == null) ? null : new String(utf8.getBytes("UTF-8"), "UTF-8"); |
tableRow.addElement(utf8); |
tableRow.addElement(utf8); |
|
|
} catch (Exception e) |
} catch (Exception e) |
{ |
{ |
System.out.println("Hey I Got an error" + e); |
System.out.println("Hey I Got an error" + e); |
|
e.printStackTrace(); |
} |
} |
m_columnClasses.addElement(java.lang.String.class); |
m_columnClasses.addElement(java.lang.String.class); |
} |
} |
Line 737 public class DBBean
|
Line 757 public class DBBean
|
} catch (Exception e) |
} catch (Exception e) |
{ |
{ |
// TODO remove |
// TODO remove |
if (FM2SQL.fmInstance != null) |
if (FM2SQL.fmInstance != null&&Convert.debug) |
FM2SQL.showErrorDialog("Error caught!! \n Query was " + query + " \n", "Debug Info"); |
FM2SQL.showErrorDialog("Error caught!! \n Query was " + query + " \n", "Debug Info"); |
|
e.printStackTrace(); |
} |
} |
|
|
return result; |
return result; |
Line 1518 public class DBBean
|
Line 1539 public class DBBean
|
ResultSet result = this.result; |
ResultSet result = this.result; |
String subQuery = query.substring(query.lastIndexOf(table) + table.length() + 1); |
String subQuery = query.substring(query.lastIndexOf(table) + table.length() + 1); |
System.out.println("subQuery " + subQuery); |
System.out.println("subQuery " + subQuery); |
makeQuery("select " + id + " from " + getQC() + table + getQC() + subQuery, numHits); |
makeQuery("select " + getQC()+id+getQC() + " from " + getQC() + table + getQC() + subQuery, numHits); |
while (true) |
while (true) |
{ |
{ |
Vector vec = getNextRow(); |
Vector vec = getNextRow(); |
Line 1545 public class DBBean
|
Line 1566 public class DBBean
|
{ |
{ |
useNormanToUnicodeMapper = b; |
useNormanToUnicodeMapper = b; |
} |
} |
|
/** |
|
* |
|
*/ |
|
protected void closeAllConnections() |
|
{ |
|
Enumeration enumeration = connectionPool.elements(); |
|
while(enumeration.hasMoreElements()) |
|
{ |
|
ConnectionPool conPol =(ConnectionPool)enumeration.nextElement(); |
|
try |
|
{ |
|
System.out.println(conPol); |
|
conPol.con.close(); |
|
} catch (SQLException e) |
|
{ |
|
// TODO Auto-generated catch block |
|
e.printStackTrace(); |
|
} |
|
} |
|
|
|
} |
|
/** |
|
* @param indexField |
|
*/ |
|
public String getColumnType(String indexField) throws SQLException |
|
{ |
|
Vector names=getColumnNames(); |
|
for (int i = 0; i < names.size(); i++) |
|
{ |
|
if(names.get(i).toString().equals(indexField)) |
|
{ |
|
System .out.println("found field "+names.get(i)+" "+metaData.getColumnTypeName(i+1)); |
|
return metaData.getColumnTypeName(i+1); |
|
|
|
} |
|
} |
|
return ""; |
|
} |
|
|
} |
} |
|
|