version 1.19, 2004/05/11 09:06:38
|
version 1.20, 2004/06/01 18:58:08
|
Line 16
|
Line 16
|
|
|
import java.sql.*; |
import java.sql.*; |
import java.text.DateFormat; |
import java.text.DateFormat; |
|
import java.text.ParseException; |
import java.util.*; |
import java.util.*; |
|
|
import com.fmi.jdbc.*; |
import com.fmi.jdbc.*; |
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 |
public Vector[] getQueryData(String table) throws SQLException,ParseException |
{ |
{ |
|
|
return getQueryData("SELECT * from " + quoteChar + table + quoteChar, maxHits); |
return getQueryData("SELECT * from " + quoteChar + table + quoteChar, maxHits); |
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 |
public Vector[] getQueryData(String query, int maxHits) throws SQLException, ParseException |
{ |
{ |
long timeStart = System.currentTimeMillis(); |
long timeStart = System.currentTimeMillis(); |
ResultSet resultSet = null; |
ResultSet resultSet = null; |
Line 586 public class DBBean
|
Line 587 public class DBBean
|
// method returns a java.awt.Image object for FileMaker Pro |
// method returns a java.awt.Image object for FileMaker Pro |
// container fields |
// container fields |
|
|
|
try |
|
{ |
tableRow.addElement(resultSet.getDate(i)); |
tableRow.addElement(resultSet.getDate(i)); |
m_columnClasses.addElement(java.sql.Date.class); |
|
|
} catch (Exception e) |
|
{ |
|
// work around for parse bug in FM JDBC Driver |
|
// for dates of format dd-mm-yyyy |
|
String date=resultSet.getString(i); |
|
date=date.replace('-','.'); |
|
java.text.DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT,Locale.GERMAN); |
|
java.util.Date d= dateFormat.parse(date); |
|
// Calendar cal=Calendar.getInstance(Locale.GERMAN); |
|
// cal.setTime(d); |
|
// date=(cal.get(Calendar.YEAR))+"-"+(cal.get(Calendar.MONTH)+1)+"-"+cal.get(Calendar.DATE); |
|
tableRow.addElement(new java.sql.Date(d.getTime())); |
|
System.out.println("Date "+date); |
|
} |
} else if (metaData.getColumnTypeName(i) == "NUMBER") |
} else if (metaData.getColumnTypeName(i) == "NUMBER") |
{ |
{ |
// use the ResultSet.getObject method for retieving images |
// use the ResultSet.getObject method for retieving images |