HXTT DBF
Sub Select column type
Fernando Hartmann
2009-08-17 11:09:13.0

I found one problem in the columns types returned by a sub select, if I execute a sub select retuning a date column the "upper" select see this column as a String, see the following sample, the three columns should return "equal", but this is not true !

Can you correct this please ?!




public class ColumnTipeBug {

public static void main(String[] args) throws Exception {
String connectionUrl;
Connection con;
connectionUrl = "jdbc:dbf:/C:/TEMP/";
Class.forName("com.hxtt.sql.dbf.DBFDriver");
con = DriverManager.getConnection(connectionUrl);

String sql =
" select " +
" CASE WHEN dateField = '2009-01-01' THEN 'equal' ELSE 'diff' END as DateXString," +
" CASE WHEN dateField = CDATE('01/01/2009','dd/MM/yyyy') THEN 'equal' ELSE 'diff' END as DateXCdate," +
" CASE WHEN CTOD(dateField) = CDATE('01/01/2009','dd/MM/yyyy') THEN 'equal' ELSE 'diff' END as CtodXCdate" +
" FROM (" +
" select CDATE('2009-01-01','yyyy-MM-dd') as dateField " +
" ) as m6 ";
PreparedStatement ps = con.prepareStatement(sql);
ResultSet resp = ps.executeQuery();
while (resp.next()) {
System.out.println("DateXString = " + resp.getString("DateXString") );
System.out.println("DateXCdate = " + resp.getString("DateXCdate") );
System.out.println("CtodXCdate = " + resp.getString("CtodXCdate") );
}
resp.close();
ps.close();
con.close();

}
}

The output is

DateXString = equal
DateXCdate = diff
CtodXCdate = equal





Re:Sub Select column type
HXTT Support
2009-08-18 09:42:11.0
Thanks. It's an issue which resulted by using default local calendar. Please download the latest package.


Google