Class AbstractDatabaseQuery

java.lang.Object
org.miaixz.bus.shade.screw.dialect.AbstractDatabaseQuery
All Implemented Interfaces:
DatabaseQuery
Direct Known Subclasses:
CacheDbDataBaseQuery, Db2DataBaseQuery, H2DataBaseQuery, MariaDbDataBaseQuery, MySqlDataBaseQuery, OracleDataBaseQuery, OtherDataBaseQuery, PostgreSqlDataBaseQuery, SqlServerDataBaseQuery

public abstract class AbstractDatabaseQuery extends Object implements DatabaseQuery
抽象查询
Since:
Java 17+
Author:
Kimi Liu
  • Field Details

    • columnsCaching

      protected final Map<String,List<Column>> columnsCaching
      缓存
    • connection

      protected volatile Connection connection
      Connection 双重锁,线程安全
  • Constructor Details

    • AbstractDatabaseQuery

      public AbstractDatabaseQuery(DataSource dataSource)
  • Method Details

    • close

      public static void close(ResultSet rs)
      释放资源
      Parameters:
      rs - ResultSet
    • close

      public static void close(Connection conn)
      释放资源
      Parameters:
      conn - Connection
    • close

      public static void close(ResultSet rs, Connection conn)
      释放资源
      Parameters:
      rs - ResultSet
      conn - Connection
    • close

      public static void close(ResultSet rs, Statement st, Connection conn)
      释放资源
      Parameters:
      rs - ResultSet
      st - Statement
      conn - Connection
    • getCatalog

      protected String getCatalog() throws org.miaixz.bus.core.lang.exception.InternalException
      获取 getCatalog
      Returns:
      String
      Throws:
      org.miaixz.bus.core.lang.exception.InternalException - 异常
    • getSchema

      protected String getSchema() throws org.miaixz.bus.core.lang.exception.InternalException
      获取 getSchema
      Returns:
      String
      Throws:
      org.miaixz.bus.core.lang.exception.InternalException - 异常
    • getMetaData

      protected DatabaseMetaData getMetaData() throws org.miaixz.bus.core.lang.exception.InternalException
      获取 DatabaseMetaData
      Returns:
      DatabaseMetaData
      Throws:
      org.miaixz.bus.core.lang.exception.InternalException - 异常
    • prepareStatement

      protected PreparedStatement prepareStatement(String sql) throws org.miaixz.bus.core.lang.exception.InternalException
      准备声明
      Parameters:
      sql - String SQL
      Returns:
      PreparedStatement
      Throws:
      org.miaixz.bus.core.lang.exception.InternalException - 异常
    • getPrimaryKeys

      public List<? extends PrimaryKey> getPrimaryKeys() throws org.miaixz.bus.core.lang.exception.InternalException
      根据表名获取主键
      Specified by:
      getPrimaryKeys in interface DatabaseQuery
      Returns:
      List
      Throws:
      org.miaixz.bus.core.lang.exception.InternalException - 异常