Hi everybody,
thanks for the great work and the quick bug-fixes. Unfortunatelly I have another problem with your JDBC-DBF-Driver. I have a table with a date-field and have SQL-Statements like
SELECT * FROM t WHER datefield='2009-16-01'
But in the resultset, there are only entries with the date '2009-17-01'
Example in Java:
-------------------------------
import java.io.File;
import java.sql.*;
public class MinimalClass {
public static void main(String[] args) {
String pathToDBF = "c:/dbf";
String connectionUrl;
Connection con;
Statement stmt;
String sSQL;
connectionUrl = "jdbc:dbf:/" + pathToDBF;
try {
// Delete the dbf-File if necessary
File file = new File(pathToDBF + "/t1.dbf");
if (file.exists()) {
file.delete();
}
Class.forName("com.hxtt.sql.dbf.DBFDriver");
con = DriverManager.getConnection(connectionUrl);
stmt = con.createStatement();
// create a Table
sSQL = "CREATE TABLE IF NOT EXISTS t1 (key INT, dt DATE)";
stmt.executeUpdate(sSQL);
// fill with values
sSQL = "INSERT INTO t1 (key, dt) VALUES (1,'2009-01-16')";
stmt.executeUpdate(sSQL);
sSQL = "INSERT INTO t1 (key, dt) VALUES (2,'2009-01-17')";
stmt.executeUpdate(sSQL);
// Output
sSQL = "SELECT * FROM t1 WHERE dt='2009-01-16'";
ResultSet rs = stmt.executeQuery(sSQL);
while (rs.next()) {
System.out.println("key: " + rs.getInt("key") + ", dt: " + rs.getDate("dt"));
}
rs.close();
stmt.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
------------------------------------------
Is it my fault?
|
That issue was resulted by mixture using gmt calendar and local canlendar since v4.2.020.
If you used "SELECT * FROM t1 WHERE dt={d '2009-01-16'};", you will get the correct result.
BTW, the latest package will skip that issue. That package will be availabe after about 2 hours.
|