程序包 com.sh.util

类 DBUtil

java.lang.Object
com.sh.util.DBUtil

public class DBUtil extends Object
Description: 数据库管理工具类,目前只支持ORACLE Title:首亨软件 - CRM、TSS、ERP等信息化管理软件
  • 字段详细资料

    • RET_SUCCESS

      public static final int RET_SUCCESS
      另请参阅:
    • RET_ERROR

      public static final int RET_ERROR
      另请参阅:
    • CONNECT_ERROR

      public static final int CONNECT_ERROR
      另请参阅:
    • PARAMETER_ERROR

      public static final int PARAMETER_ERROR
      另请参阅:
    • TABLE_EXIST

      public static final int TABLE_EXIST
      另请参阅:
    • TABLE_NOT_EXIST

      public static final int TABLE_NOT_EXIST
      另请参阅:
    • COLUMN_EXIST

      public static final int COLUMN_EXIST
      另请参阅:
    • COLUMN_NOT_EXIST

      public static final int COLUMN_NOT_EXIST
      另请参阅:
    • SEQUENCES_EXIST

      public static final int SEQUENCES_EXIST
      另请参阅:
    • SEQUENCES_NOT_EXIST

      public static final int SEQUENCES_NOT_EXIST
      另请参阅:
    • INDEX_EXIST

      public static final int INDEX_EXIST
      另请参阅:
    • INDEX_NOT_EXIST

      public static final int INDEX_NOT_EXIST
      另请参阅:
  • 构造器详细资料

    • DBUtil

      public DBUtil()
  • 方法详细资料

    • refreshActiveSession

      public static void refreshActiveSession(int actionSessions)
    • isTableExist

      public static int isTableExist(DataCenter dc, String tableName)
      判断表是否存在 目前只有ORACLE有效
      参数:
      dc - DataCenter
      tableName - tableName
      返回:
      int
    • isColumnExist

      public static int isColumnExist(DataCenter dc, String tableName, String columnName)
      判断表中的列是否存在
      参数:
      dc - DataCenter
      tableName - String
      columnName - String
      返回:
      0 存在
    • isSequencesExist

      public static int isSequencesExist(DataCenter dc, String seqName)
      判断序列是否存在
      参数:
      dc - DataCenter
      seqName - String
      返回:
      int
    • isIndexExist

      public static int isIndexExist(DataCenter dc, String tableName, String indexName)
      判断索引是否存在
      参数:
      dc - DataCenter
      tableName - String
      indexName - String
      返回:
      int
    • getActiveSessions

      public static int getActiveSessions(DataCenter dc)
      获取当前数据库的最大连接数
      参数:
      dc - DataCenter
      返回:
      int
    • executeEnable

      public static boolean executeEnable(DataCenter dc)
      根据数据库当前的活动连接数判断是否可执行当前查询操作
      参数:
      dc - DataCenter
      返回:
      boolean
    • generateNoWaitSQL

      public static String generateNoWaitSQL(DataCenter dc)
      SQL中SELECT锁表无等待返回
      参数:
      dc - DataCenter
      返回:
      String
    • generateWaitTimeoutSQL

      public static String generateWaitTimeoutSQL(DataCenter dc)
      设置行级锁等待资源时间SQL,默认时间:2S
      参数:
      dc - DataCenter
      返回:
      String
    • generateWaitTimeoutSQL

      public static String generateWaitTimeoutSQL(DataCenter dc, int timeout)
      设置行级锁等待资源时间SQL
      参数:
      dc - DataCenter
      timeout - 等待资源超时时长
      返回:
      String
    • convertDDLSql

      public static String convertDDLSql(String sql)
    • convertDDLSql

      public static String convertDDLSql(DataCenter dc, String sql)
      转化创建表的SQL
      参数:
      dc - DataCenter
      sql - SQL
      返回:
      String 要求:全部大写
    • isUnique

      public static boolean isUnique(DataCenter dc, String tableName, String[] idCol, String[] param) throws Exception
      判断是否唯一
      参数:
      dc - DataCenter
      tableName - String
      idCol - String[]
      param - String[]
      返回:
      boolean
      抛出:
      Exception - Exception
    • delData

      public static String[] delData(DataCenter dc, String tableName, String pkCol, String[] param)
      删除数据
      参数:
      dc - 数据中心
      tableName - 表名
      pkCol - 主键列
      param - 参数值
      返回:
      String[]