Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
*/
public final class CQueryPredicates {

/**
* Default lower bound used for findVersions() (no explicit start/end) on sql2011
* standards based platforms that require actual bind values for the root table's
* 'for system_time between ? and ?' clause.
*/
private static final Timestamp EPOCH = Timestamp.valueOf("1970-01-01 00:00:00");

private final Binder binder;
private final OrmQueryRequest<?> request;
private final SpiQuery<?> query;
Expand Down Expand Up @@ -84,10 +91,16 @@ public String bind(DataBind dataBind) throws SQLException {
// bind the update set clause
updateProperties.bind(binder, dataBind);
}
if (query.isVersionsBetween() && binder.isAsOfStandardsBased()) {
if (binder.isAsOfStandardsBased() && query.temporalMode() == SpiQuery.TemporalMode.VERSIONS) {
// sql2011 based versions between timestamp syntax
Timestamp start = query.versionStart();
Timestamp end = query.versionEnd();
if (start == null) {
start = EPOCH;
}
if (end == null) {
end = new Timestamp(System.currentTimeMillis());
}
dataBind.append("between ").append(start).append(" and ").append(end);
binder.bindObject(dataBind, start);
binder.bindObject(dataBind, end);
Expand Down
Loading