Is it possible to bind a java sql timestamp within the generated query?
> java.sql.Timestamp now = new java.sql.Timestamp(new
> Date().getTime());
> Settings settings = new Settings();
> settings.setStatementType(StatementType.STATIC_STATEMENT);
> Connection con = DriverManager.getConnection(...);
> final Factory create = new OracleFactory(con,settings);
> Statement s = con.createStatement();
> s.execute("drop table test_table");
> s.execute("create table test_table ( test_column DATE )");
> s.execute("insert into test_table values (to_date('20020315',
> 'yyyymmdd'))");
final org.jooq.Table<org.jooq.Record> table =
> create.tableByName("TEST_TABLE");
> final org.jooq.SelectSelectStep sss = create.select(create.count());
> final org.jooq.SelectJoinStep sjs = sss.from(table);
> final org.jooq.SelectConditionStep scs =
> sjs.where(create.fieldByName("TEST_COLUMN").lessThan(now));
System.out.println(scs.toSQL());
>
Generates
select count(*) from "TEST_TABLE" where "TEST_COLUMN" <
> '2012-12-12 22:01:21.929'
How can I get the correct to_date conversion for the variable now, without
having to use a prepared statement?
Timm