java.lang.Object
org.miaixz.bus.pager.dialect.auto.Early
- All Implemented Interfaces:
AutoDialect<String>
Early version default implementation for auto-detecting database dialects. This approach involves obtaining a
connection to extract the JDBC URL, which is highly generic but can be less performant and may lead to issues if
connections are not properly closed.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AutoDialect<String> Default instance of the Early auto-dialect. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextractDialect(String dialectKey, org.apache.ibatis.mapping.MappedStatement ms, DataSource dataSource, Properties properties) Extracts and returns the appropriateAbstractPagingdialect based on the extracted JDBC URL.extractDialectKey(org.apache.ibatis.mapping.MappedStatement ms, DataSource dataSource, Properties properties) Extracts the dialect key (JDBC URL) from the DataSource by obtaining a connection.
-
Field Details
-
DEFAULT
Default instance of the Early auto-dialect.
-
-
Constructor Details
-
Early
public Early()
-
-
Method Details
-
extractDialectKey
public String extractDialectKey(org.apache.ibatis.mapping.MappedStatement ms, DataSource dataSource, Properties properties) Extracts the dialect key (JDBC URL) from the DataSource by obtaining a connection. This method is generic but can be less efficient due to connection handling.- Specified by:
extractDialectKeyin interfaceAutoDialect<String>- Parameters:
ms- the MappedStatement being executeddataSource- the DataSource associated with the MappedStatementproperties- the configuration properties, including "closeConn" to control connection closing- Returns:
- the JDBC URL as the dialect key
- Throws:
org.miaixz.bus.core.lang.exception.PageException- if a SQLException occurs while getting the connection or its metadata
-
extractDialect
public AbstractPaging extractDialect(String dialectKey, org.apache.ibatis.mapping.MappedStatement ms, DataSource dataSource, Properties properties) Extracts and returns the appropriateAbstractPagingdialect based on the extracted JDBC URL.- Specified by:
extractDialectin interfaceAutoDialect<String>- Parameters:
dialectKey- the JDBC URL obtained fromextractDialectKey(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 - Throws:
org.miaixz.bus.core.lang.exception.PageException- if the database type cannot be automatically obtained or if dialect instantiation fails
-