Class SqlServerDialect

java.lang.Object
nablarch.core.db.dialect.DefaultDialect
nablarch.core.db.dialect.SqlServerDialect
All Implemented Interfaces:
Dialect

@Published(tag="architect") public class SqlServerDialect extends DefaultDialect
SqlServer用のSQL方言クラス。
  • Constructor Details

    • SqlServerDialect

      public SqlServerDialect()
  • Method Details

    • supportsIdentity

      public boolean supportsIdentity()
      IDENTITY(オートインクリメントカラム)が使用できるか否か。

      SQLServerは、identityカラムが定義できるのでtrueを返す。

      Specified by:
      supportsIdentity in interface Dialect
      Overrides:
      supportsIdentity in class DefaultDialect
      Returns:
      falseを返す。
    • isDuplicateException

      public boolean isDuplicateException(SQLException sqlException)
      SQL例外が一意制約違反による例外か否か。

      キー重複(エラーコード:2627)及びユニークインデックスの値重複(エラーコード:2601)の場合に、 重複エラーとする。

      Specified by:
      isDuplicateException in interface Dialect
      Overrides:
      isDuplicateException in class DefaultDialect
      Parameters:
      sqlException - SQL例外
      Returns:
      falseを返す。
    • isTransactionTimeoutError

      public boolean isTransactionTimeoutError(SQLException sqlException)
      SQL例外がトランザクションタイムアウトと判断すべき例外か否か。

      クエリーの実行キャンセルを表すSQLState(HY008)の場合のみトランザクションタイムアウト対象の例外とする。

      Specified by:
      isTransactionTimeoutError in interface Dialect
      Overrides:
      isTransactionTimeoutError in class DefaultDialect
      Parameters:
      sqlException - SQL例外
      Returns:
      falseを返す。
    • getResultSetConvertor

      public ResultSetConvertor getResultSetConvertor()
      ResultSetから値を取得するための変換クラスを返却する。

      全てのカラムをResultSet.getObject(int)で取得するコンバータを返す。

      varbinary(max)で定義されたカラムの場合は、ResultSet.getBinaryStream(int)の結果を返す、 ResultSetの変換クラスを返却する。

      Specified by:
      getResultSetConvertor in interface Dialect
      Overrides:
      getResultSetConvertor in class DefaultDialect
      Returns:
      変換クラス。
    • convertCountSql

      public String convertCountSql(String sql)
      SQL文をレコード数取得用のSQL文に変換する。

      以下形式のCOUNT文取得用SQL文に変換する。
      SELECT COUNT(*) COUNT_ FROM ('引数のSQL') SUB_ SQLServerは、インラインビュー内にORDER BYを記述することが出来ない。 このため、レコード数取得のSQLに変換する際にSQLの一番最後に存在しているORDER BYを削除後に 件数取得用のSQLに変換する。

      Specified by:
      convertCountSql in interface Dialect
      Overrides:
      convertCountSql in class DefaultDialect
      Parameters:
      sql - SQL文
      Returns:
      変換したSQL文
    • getPingSql

      public String getPingSql()
      Description copied from class: DefaultDialect
      ping用のSQL文を返す。

      データベースへの死活チェックを行うための、ping用SQL文を生成する。 デフォルト実装では、本メソッドはサポートしない。

      Specified by:
      getPingSql in interface Dialect
      Overrides:
      getPingSql in class DefaultDialect
      Returns:
      ping用のSQL文