- Type Parameters:
K- the type of the cache key used for storing dialect instances
- All Known Implementing Classes:
AbstractAutoDialect,Defalut,Druid,Early,Hikari
public interface AutoDialect<K>
Interface for automatically obtaining a database dialect. Implementations of this interface are responsible for
determining the appropriate dialect based on the provided MappedStatement, DataSource, and properties.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Method Summary
Modifier and TypeMethodDescriptionextractDialect(K dialectKey, org.apache.ibatis.mapping.MappedStatement ms, DataSource dataSource, Properties properties) Extracts and returns the appropriateAbstractPagingdialect.extractDialectKey(org.apache.ibatis.mapping.MappedStatement ms, DataSource dataSource, Properties properties) Retrieves the key used for caching the return value of theextractDialect(K, org.apache.ibatis.mapping.MappedStatement, javax.sql.DataSource, java.util.Properties)method.
-
Method Details
-
extractDialectKey
K extractDialectKey(org.apache.ibatis.mapping.MappedStatement ms, DataSource dataSource, Properties properties) Retrieves the key used for caching the return value of theextractDialect(K, org.apache.ibatis.mapping.MappedStatement, javax.sql.DataSource, java.util.Properties)method. If this method returns null, the dialect will not be cached. If a key is returned, the system first checks if it already exists. If not,extractDialect(K, org.apache.ibatis.mapping.MappedStatement, javax.sql.DataSource, java.util.Properties)is called, and the result is then cached.- Parameters:
ms- the MappedStatement being executeddataSource- the DataSource associated with the MappedStatementproperties- the configuration properties- Returns:
- the cache key for the dialect, or null if caching is not desired
-
extractDialect
AbstractPaging extractDialect(K dialectKey, org.apache.ibatis.mapping.MappedStatement ms, DataSource dataSource, Properties properties) Extracts and returns the appropriateAbstractPagingdialect. This method is responsible for creating or retrieving the dialect instance based on the provided information.- Parameters:
dialectKey- the cache key for the dialect, as returned byextractDialectKey(org.apache.ibatis.mapping.MappedStatement, javax.sql.DataSource, java.util.Properties)ms- the MappedStatement being executeddataSource- the DataSource associated with the MappedStatementproperties- the configuration properties- Returns:
- an instance of
AbstractPagingrepresenting the determined dialect
-