Package io.ebean.config.dbplatform
Class DbViewHistorySupport
- java.lang.Object
-
- io.ebean.config.dbplatform.DbViewHistorySupport
-
- All Implemented Interfaces:
DbHistorySupport
- Direct Known Subclasses:
H2HistorySupport,MySqlHistorySupport,NuoDbHistorySupport,PostgresHistorySupport
public abstract class DbViewHistorySupport extends Object implements DbHistorySupport
Database view based implementation of DbHistorySupport.These implementations have explicit history tables, a view to union the base table and history table and triggers to maintain the history.
-
-
Constructor Summary
Constructors Constructor Description DbViewHistorySupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAsOfPredicate(String asOfTableAlias, String asOfSysPeriod)Return the 'as of' predicate clause appended to the end of the normal query predicates.StringgetAsOfViewSuffix(String asOfViewSuffix)Returns the configured view suffix.intgetBindCount()Return 2 if we have effective start and effective end as 2 columns.StringgetSysPeriodLower(String tableAlias, String sysPeriod)Return the lower bound column prepended with the table alias.StringgetSysPeriodUpper(String tableAlias, String sysPeriod)Return the upper bound column prepended with the table alias.StringgetVersionsBetweenSuffix(String asOfViewSuffix)Returns the configured view suffix (same as getAsOfViewSuffix()).booleanisStandardsBased()Return true if the implementation is SQL2011 standards based.
-
-
-
Constructor Detail
-
DbViewHistorySupport
public DbViewHistorySupport()
-
-
Method Detail
-
isStandardsBased
public boolean isStandardsBased()
Description copied from interface:DbHistorySupportReturn true if the implementation is SQL2011 standards based.Non standards based means we need to add additional predicates into the JOIN ON clause and add an additional predicate for the base table.
- Specified by:
isStandardsBasedin interfaceDbHistorySupport
-
getAsOfViewSuffix
public String getAsOfViewSuffix(String asOfViewSuffix)
Returns the configured view suffix.- Specified by:
getAsOfViewSuffixin interfaceDbHistorySupport- Parameters:
asOfViewSuffix- the configured view suffix (typically "_with_history").- Returns:
- The suffix appended after the base table name in the from and join clauses.
-
getVersionsBetweenSuffix
public String getVersionsBetweenSuffix(String asOfViewSuffix)
Returns the configured view suffix (same as getAsOfViewSuffix()).- Specified by:
getVersionsBetweenSuffixin interfaceDbHistorySupport- Parameters:
asOfViewSuffix- the configured view suffix (typically "_with_history").
-
getBindCount
public int getBindCount()
Return 2 if we have effective start and effective end as 2 columns. Note that for postgres we can use a single range type so that returns 1.- Specified by:
getBindCountin interfaceDbHistorySupport
-
getAsOfPredicate
public String getAsOfPredicate(String asOfTableAlias, String asOfSysPeriod)
Return the 'as of' predicate clause appended to the end of the normal query predicates.- Specified by:
getAsOfPredicatein interfaceDbHistorySupport- Parameters:
asOfTableAlias- The table alias this predicate is added forasOfSysPeriod- The name of the 'sys_period' column used for effective date time range.- Returns:
- The predicate containing a single ? bind parameter which will be bound to the 'as at' timestamp value
-
getSysPeriodLower
public String getSysPeriodLower(String tableAlias, String sysPeriod)
Return the lower bound column prepended with the table alias.- Specified by:
getSysPeriodLowerin interfaceDbHistorySupport- Parameters:
tableAlias- the table aliassysPeriod- the name of the sys_period column
-
getSysPeriodUpper
public String getSysPeriodUpper(String tableAlias, String sysPeriod)
Return the upper bound column prepended with the table alias.- Specified by:
getSysPeriodUpperin interfaceDbHistorySupport- Parameters:
tableAlias- the table aliassysPeriod- the name of the sys_period column
-
-