version 1.31, 2004/08/09 11:36:18
|
version 1.37, 2004/10/29 10:28:10
|
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 377 public class DBBean
|
Line 378 public class DBBean
|
* Returns the result for select * from table |
* Returns the result for select * from table |
* with maxHits = 500 default value |
* with maxHits = 500 default value |
*/ |
*/ |
public Vector[] getQueryData(String table) throws SQLException, ParseException |
public Vector[] getQueryData(String table) throws SQLException, ParseException,Exception |
{ |
{ |
|
|
return getQueryData("SELECT * from " + quoteChar + table + quoteChar, maxHits); |
return getQueryData("SELECT * from " + quoteChar + table + quoteChar, maxHits); |
Line 388 public class DBBean
|
Line 389 public class DBBean
|
* Returns the result of the query |
* Returns the result of the query |
* or an Vector array of Vectors containing error messages |
* or an Vector array of Vectors containing error messages |
*/ |
*/ |
public Vector[] getQueryData(String query, FM2SQL.ProgressDialog dialog, int maxHits) throws SQLException |
public Vector[] getQueryData(String query, FM2SQL.ProgressDialog dialog, int maxHits) throws SQLException,Exception |
{ |
{ |
long timeStart = System.currentTimeMillis(); |
long timeStart = System.currentTimeMillis(); |
ResultSet resultSet = null; |
ResultSet resultSet = null; |
Line 457 public class DBBean
|
Line 458 public class DBBean
|
* Returns the result of the query |
* Returns the result of the query |
* or an Vector array of Vectors containing error messages |
* or an Vector array of Vectors containing error messages |
*/ |
*/ |
public Vector[] getQueryData(String query, int maxHits) throws SQLException, ParseException |
public Vector[] getQueryData(String query, int maxHits) throws SQLException, ParseException,Exception |
{ |
{ |
long timeStart = System.currentTimeMillis(); |
long timeStart = System.currentTimeMillis(); |
ResultSet resultSet = null; |
ResultSet resultSet = null; |
Line 652 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 709 public class DBBean
|
Line 719 public class DBBean
|
* with the numberOfHits as maximum |
* with the numberOfHits as maximum |
* @return the result as an ResultSet object |
* @return the result as an ResultSet object |
*/ |
*/ |
public ResultSet makeQuery(String query, int numberOfHits) throws SQLException |
public ResultSet makeQuery(String query, int numberOfHits) throws SQLException,Exception |
{ |
{ |
result = null; |
result = null; |
Statement stm = null; |
Statement stm = null; |
Line 747 public class DBBean
|
Line 757 public class DBBean
|
} catch (Exception e) |
} catch (Exception e) |
{ |
{ |
// TODO remove |
// TODO remove |
if (FM2SQL.fmInstance != null) |
if (Convert.isGUI&&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(); |
|
throw e; |
} |
} |
|
|
return result; |
return result; |
Line 1528 public class DBBean
|
Line 1540 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+"order by "+id, numHits); |
makeQuery("select " + getQC()+id+getQC() + " from " + getQC() + table + getQC() + subQuery, numHits); |
while (true) |
while (true) |
{ |
{ |
Vector vec = getNextRow(); |
Vector vec = getNextRow(); |