クラス RdbAdapter

java.lang.Object
org.iplass.mtp.impl.rdb.adapter.RdbAdapter
直系の既知のサブクラス:
MysqlRdbAdaptor, NoopRdbAdapter, OracleRdbAdapter, PostgreSQLRdbAdapter, SqlServerRdbAdapter

public abstract class RdbAdapter extends Object
  • コンストラクタの詳細

    • RdbAdapter

      public RdbAdapter()
  • メソッドの詳細

    • addAggregateFunction

      protected <T extends Aggregate> void addAggregateFunction(Class<T> aggType, AggregateFunctionAdapter<T> functionAdapter)
    • addFunction

      protected void addFunction(FunctionAdapter<Function> functionAdapter)
    • getUpdateSqlCreator

      public <T extends UpdateSqlHandler> T getUpdateSqlCreator(Class<T> sqlCreatorClass)
    • getQuerySqlCreator

      public <T extends QuerySqlHandler> T getQuerySqlCreator(Class<T> sqlCreatorClass)
    • castExp

      public String[] castExp(int sqlType, Integer lengthOrPrecision, Integer scale)
    • cast

      public CharSequence cast(int fromSqlType, int toSqlType, CharSequence valExpr, Integer lengthOrPrecision, Integer scale)
    • countQuery

      public UnaryOperator<CharSequence> countQuery(Query q)
    • isSupportOptimizerHint

      public abstract boolean isSupportOptimizerHint()
    • getOptimizerHint

      public abstract String getOptimizerHint()
    • getOptimizerHintPlace

      public abstract HintPlace getOptimizerHintPlace()
    • getOptimizerHintBracket

      public abstract String[] getOptimizerHintBracket()
    • isSupportTableHint

      public abstract boolean isSupportTableHint()
    • getTableHintBracket

      public abstract String[] getTableHintBracket()
    • getDataTypeOf

      protected abstract String getDataTypeOf(int sqlType, Integer lengthOrPrecision, Integer scale)
    • getRdbTypeAdapter

      public BaseRdbTypeAdapter getRdbTypeAdapter(Object value)
    • getRdbTypeAdapter

      public BaseRdbTypeAdapter getRdbTypeAdapter(PropertyType propType)
    • toSqlExp

      public String toSqlExp(Object rdbValue)
    • setParameter

      public void setParameter(PreparedStatement ps, int index, Object rdbValue) throws SQLException
      例外:
      SQLException
    • toDateExpression

      public abstract String toDateExpression(Date date)
    • toTimeExpression

      public abstract String toTimeExpression(Time time)
    • toTimeStampExpression

      public abstract String toTimeStampExpression(Timestamp date)
    • sanitize

      public String sanitize(String str)
    • resolveFunction

      public final FunctionAdapter<Function> resolveFunction(String name)
    • resolveAggregateFunction

      public final <T extends Aggregate> AggregateFunctionAdapter<T> resolveAggregateFunction(Class<T> aggClass)
    • systimestamp

      public abstract String systimestamp()
    • createMultiInsertContext

      public abstract MultiInsertContext createMultiInsertContext(Statement stmt)
    • createBulkInsertContext

      public abstract BulkInsertContext createBulkInsertContext()
    • createBulkUpdateContext

      public abstract BulkUpdateContext createBulkUpdateContext()
    • createBulkDeleteContext

      public abstract BulkDeleteContext createBulkDeleteContext()
    • getConnection

      public final Connection getConnection() throws SQLException
      例外:
      SQLException
    • getConnection

      public Connection getConnection(String connectionFactoryName) throws SQLException
      例外:
      SQLException
    • seqNextSelectSql

      public abstract String seqNextSelectSql(String sequenceName, int tenantId, String entityDefId)
    • isUseSubQueryForIndexJoin

      public abstract boolean isUseSubQueryForIndexJoin()
    • dual

      public abstract String dual()
    • rowLockExpression

      public abstract String rowLockExpression()
    • toLimitSql

      public String toLimitSql(String selectSql, int limitCount, int offset)
    • toLimitSql

      public abstract String toLimitSql(String selectSql, int limitCount, int offset, boolean asBind)
    • toLimitSqlBindValue

      public abstract Object[] toLimitSqlBindValue(int limitCount, int offset)
    • isDuplicateValueException

      public abstract boolean isDuplicateValueException(SQLException e)
    • isDeadLock

      public abstract boolean isDeadLock(SQLException e)
    • isLockFailed

      public abstract boolean isLockFailed(SQLException e)
    • isCastFailed

      public abstract boolean isCastFailed(SQLException e)
    • addDate

      public abstract String addDate(String dateExpression, int day)
    • checkStatusQuery

      public abstract String checkStatusQuery()
    • sanitizeForLike

      public final String sanitizeForLike(String str)
      SQLのlike文のパターン文字列に設定するエスケープ処理。 '自体のエスケープはしない。
      パラメータ:
      str -
      戻り値:
    • likePattern

      public abstract String likePattern(String str)
      EQLのLikeのパターン文字列で、 %、_、\を\でエスケープされているEQLでの文字列を、RDBネイティブなエスケープ構文に変換する。
      パラメータ:
      str -
      戻り値:
    • escape

      public abstract String escape()
      Likeのエスケープ文字指定構文。
      戻り値:
    • tableAlias

      public abstract String tableAlias(String selectSql)
    • isSupportGroupingExtention

      public abstract boolean isSupportGroupingExtention(GroupBy.RollType rollType)
    • isSupportGroupingExtention

      public abstract boolean isSupportGroupingExtention()
    • isSupportGroupingExtentionWithOrderBy

      public abstract boolean isSupportGroupingExtentionWithOrderBy()
    • rollUpStart

      public abstract String rollUpStart(GroupBy.RollType rollType)
    • rollUpEnd

      public abstract String rollUpEnd(GroupBy.RollType rollType)
    • appendSortSpecExpression

      public abstract void appendSortSpecExpression(StringBuilder sb, CharSequence sortValue, SortSpec.SortType sortType, SortSpec.NullOrderingSpec nullOrderingSpec)
    • getListaggDefaultSeparator

      public String getListaggDefaultSeparator()
    • setListaggDefaultSeparator

      public void setListaggDefaultSeparator(String listaggDefaultSeparator)
    • getRdbTimeZone

      public String getRdbTimeZone()
    • setRdbTimeZone

      public void setRdbTimeZone(String rdbTimeZone)
    • rdbTimeZone

      public TimeZone rdbTimeZone()
    • rdbCalendar

      public Calendar rdbCalendar()
    • javaCalendar

      public Calendar javaCalendar()
    • convertTZ

      public abstract String[] convertTZ(String to)
      timezoneを変更したtimestampを取得する関数。 変換前のtimestampはデフォルトタイムゾーン(DBのタイムゾーンもしくはDBセッションのタイムゾーン)と同一である想定。
      パラメータ:
      to -
      戻り値:
      [0]がpre文字列、[1]がpost文字列
    • upperFunctionName

      public String upperFunctionName()
    • initBlob

      public abstract String initBlob()
    • isEnableInPartitioning

      public abstract boolean isEnableInPartitioning()
    • getInPartitioningSize

      public abstract int getInPartitioningSize()
    • isSupportGlobalTemporaryTable

      public abstract boolean isSupportGlobalTemporaryTable()
      global temporary tableをサポートしている場合はtrue
      戻り値:
    • isSupportAutoClearTemporaryTableWhenCommit

      public abstract boolean isSupportAutoClearTemporaryTableWhenCommit()
    • createLocalTemporaryTable

      public abstract String createLocalTemporaryTable(String tableName, String baseTableName, String[] baseColumnName)
      ローカルなTemporaryTableを作成する。
    • deleteTemporaryTable

      public abstract String deleteTemporaryTable(String tableName)
      TemporaryTableを削除(global temporary tableの場合はデータを削除する)するSQLを生成。
      パラメータ:
      tableName -
      戻り値:
    • isEnableBindHint

      public abstract boolean isEnableBindHint()
      bindヒント句を有効化するか否か
      戻り値:
    • isAlwaysBind

      public abstract boolean isAlwaysBind()
      EQLをSQLに変換する際、常にバインド変数化するか否か。
      戻り値:
    • getBatchSize

      public abstract int getBatchSize()
      バッチ更新利用する際の推奨バッチサイズ。
      戻り値:
    • getMaxFetchSize

      public abstract int getMaxFetchSize()
    • getDefaultQueryTimeout

      public abstract int getDefaultQueryTimeout()
    • getDefaultFetchSize

      public abstract int getDefaultFetchSize()
    • getThresholdCountOfUsePrepareStatement

      public abstract int getThresholdCountOfUsePrepareStatement()
      複数の更新(追加)を一括で処理する際の、PrepareStatementを利用するか否かを判断するための閾値。
      戻り値:
    • aggregateFunctionName

      public String aggregateFunctionName(Aggregate agg)
    • isSupportWindowFunction

      public abstract boolean isSupportWindowFunction()
    • windowRankFunctionName

      public String windowRankFunctionName(WindowRankFunction rankFunc)
    • getMultiTableUpdateMethod

      public abstract MultiTableUpdateMethod getMultiTableUpdateMethod()
    • getTableNames

      public abstract ResultSet getTableNames(String tableNamePattern, Connection con) throws SQLException
      例外:
      SQLException
    • getTemplaryTablePrefix

      public String getTemplaryTablePrefix()
    • createRowLockSql

      public String createRowLockSql(String sql)
      行ロックのSQLを作成します。

      DMLの判別はしていません。SELECT文に対してのみ使用してください。

      パラメータ:
      sql - 行ロックのSQLを作成するSQL。
      戻り値:
      行ロックを行うSQL
    • isSupportRowValueConstructor

      public boolean isSupportRowValueConstructor()
      行値構成子(行値式)をサポートしているかを判別します。
      戻り値:
      サポートしている場合はtrueを返します。
    • isNeedFromClauseTableAliasUpdateStatement

      public boolean isNeedFromClauseTableAliasUpdateStatement()
      UPDATE文の表名にエイリアスを使用する場合はFROM句が必要かを判別します。
      戻り値:
      FROM句が必要な場合はtrueを返します。
    • isSupportBlobType

      public boolean isSupportBlobType()
      BLOB型をサポートしているかを判別します。
      戻り値:
      サポートしている場合はtrueを返します。
    • getDefaultOrderByForLimit

      public String getDefaultOrderByForLimit()
      LIMIT句のための省略時のOrderBy句を取得します。
      戻り値:
      OrderBy句
    • getViewSubQueryAlias

      public String getViewSubQueryAlias()
      ビューのサブクエリエイリアスを取得します。
      戻り値:
      エイリアス
    • getMaxViewNameLength

      public int getMaxViewNameLength()
      ビュー名の最大長を取得します。
      戻り値:
      ビュー名の最大長。0未満の場合は無制限。
    • createViewColumnSql

      public abstract String createViewColumnSql(int colNo, String colName)
      ビューカラムのSQLを作成します。
      パラメータ:
      colNo - カラム番号
      colName - カラム名
      戻り値:
      ビューカラムSQL
    • createBinaryViewColumnSql

      public abstract String createBinaryViewColumnSql(int colNo, String colName, String lobIdSuffix)
      Binary型のビューカラムのSQLを作成します。
      パラメータ:
      colName - カラム名
      lobIdSuffix - ロブIDカラム接尾辞
      colNum - カラム番号
      戻り値:
      ビューカラムSQL
    • createLongTextViewColumnSql

      public abstract String createLongTextViewColumnSql(int colNo, String colName, String lobIdSuffix)
      LongText型のビューカラムのSQLを作成します。
      パラメータ:
      colName - カラム名
      lobIdSuffix - LobIDカラム接尾辞
      colNum - カラム番号
      戻り値:
      ビューカラムSQL
    • toCreateViewDDL

      public abstract String toCreateViewDDL(String viewName, String selectSql, boolean withDropView)
      指定のSELECT文をビュー作成DDLにします。
      パラメータ:
      viewName - ビュー名
      selectSql - SELECT文
      withDropView - ビュー削除も含める
      戻り値:
      ビュー作成DDL
    • isNeedMultiTableTrick

      public boolean isNeedMultiTableTrick()
      Multi-Table Trickを利用するか否かを指定。 MySQL用の設定項目。
      戻り値:
    • getMultiTableTrickClauseForUpdate

      public String getMultiTableTrickClauseForUpdate()
      Multi-Table Trickで利用する句。 MySQL用の設定項目。
      戻り値: