Interface FailoverStoreQueryResolver
- All Known Implementing Classes:
DefaultFailoverStoreQueryResolver
public interface FailoverStoreQueryResolver
Contract for resolving JDBC queries, binding parameters, and mapping result-set rows
for the failover store.
Implementations own the SQL text, column ordering, SQL types, and result-set mapping so that schema changes require edits in exactly one place.
- Author:
- Anand Manissery
- See Also:
-
Method Summary
Modifier and TypeMethodDescription<T> Object[]buildInsertMergeParams(ReferentialPayload<T> payload) Builds the parameter array for INSERT and all MERGE/upsert queries.int[]SQL types matchingbuildInsertMergeParams(com.societegenerale.failover.core.payload.ReferentialPayload<T>)column order.<T> Object[]buildUpdateParams(ReferentialPayload<T> payload) Builds the parameter array for the UPDATE query (SET columns first, then WHERE predicate).int[]SQL types matchingbuildUpdateParams(com.societegenerale.failover.core.payload.ReferentialPayload<T>)column order.Resolves the cleanup query.Resolves the count query.Resolves the DELETE-one query.Resolves the INSERT query.@Nullable StringNative merge/upsert query for the detected database dialect, ornullwhen no known dialect is available — the store falls back to INSERT + UPDATE on duplicate in that case.Resolves the SELECT-all query.Resolves the SELECT-one query.Resolves the UPDATE query.
-
Method Details
-
getInsertQuery
String getInsertQuery()Resolves the INSERT query.- Returns:
- the INSERT SQL for a new row
-
getUpdateQuery
String getUpdateQuery()Resolves the UPDATE query.- Returns:
- the UPDATE SQL for an existing row (SET columns first, then WHERE predicate)
-
getSelectQuery
String getSelectQuery()Resolves the SELECT-one query.- Returns:
- the SELECT SQL that retrieves a single row by
FAILOVER_NAMEandFAILOVER_KEY
-
getSelectAllByNameQuery
String getSelectAllByNameQuery()Resolves the SELECT-all query.- Returns:
- the SELECT SQL that retrieves all rows for a given
FAILOVER_NAME
-
getDeleteQuery
String getDeleteQuery()Resolves the DELETE-one query.- Returns:
- the DELETE SQL that removes a single row by
FAILOVER_NAMEandFAILOVER_KEY
-
getCleanUpQuery
String getCleanUpQuery()Resolves the cleanup query.- Returns:
- the DELETE SQL that removes all rows with
EXPIRE_ONbefore a given timestamp
-
getCountByNameQuery
String getCountByNameQuery()Resolves the count query.- Returns:
- the
SELECT COUNT(*)SQL counting all rows for a givenFAILOVER_NAME(capacity gauge)
-
getMergeQuery
@Nullable String getMergeQuery()Native merge/upsert query for the detected database dialect, ornullwhen no known dialect is available — the store falls back to INSERT + UPDATE on duplicate in that case.- Returns:
- the native MERGE/upsert SQL, or
nullwhen unavailable
-
buildInsertMergeParams
Builds the parameter array for INSERT and all MERGE/upsert queries. Column order: FAILOVER_NAME, FAILOVER_KEY, AS_OF, EXPIRE_ON, PAYLOAD, PAYLOAD_CLASS.- Type Parameters:
T- the payload type- Parameters:
payload- the row to insert/merge- Returns:
- the bound parameter array, in column order
-
buildInsertMergeTypes
int[] buildInsertMergeTypes()SQL types matchingbuildInsertMergeParams(com.societegenerale.failover.core.payload.ReferentialPayload<T>)column order.- Returns:
- the JDBC
java.sql.Typesarray matchingbuildInsertMergeParams(com.societegenerale.failover.core.payload.ReferentialPayload<T>)
-
buildUpdateParams
Builds the parameter array for the UPDATE query (SET columns first, then WHERE predicate). Column order: AS_OF, EXPIRE_ON, PAYLOAD, PAYLOAD_CLASS, FAILOVER_NAME, FAILOVER_KEY.- Type Parameters:
T- the payload type- Parameters:
payload- the row to update- Returns:
- the bound parameter array, in column order
-
buildUpdateTypes
int[] buildUpdateTypes()SQL types matchingbuildUpdateParams(com.societegenerale.failover.core.payload.ReferentialPayload<T>)column order.- Returns:
- the JDBC
java.sql.Typesarray matchingbuildUpdateParams(com.societegenerale.failover.core.payload.ReferentialPayload<T>)
-