类 DatabaseUtils

java.lang.Object
com.walker.dbmeta.util.DatabaseUtils

public abstract class DatabaseUtils extends Object
  • 字段详细资料

  • 构造器详细资料

    • DatabaseUtils

      public DatabaseUtils()
  • 方法详细资料

    • copyAddress

      public static Address copyAddress(Address addr, boolean isUsing, int suffixIndex, String defineName)
      克隆一个Address资源地址对象
      参数:
      addr -
      isUsing - 是否正在使用
      suffixIndex - 命名的后缀,多库使用
      返回:
    • getMySQLSchemaName

      public static final String getMySQLSchemaName(String serviceName)
      把MySQL的服务名字中提取数据库,因为里面会有参数,如:walkersoft-share-marks?characterEncoding=UTF-8

      提取之后结果为:walkersoft-share-marks
      参数:
      serviceName -
      返回:
    • getDatabaseNameIndex

      public static final int getDatabaseNameIndex(String dbName)
      返回数据库名字后面的后缀,如果不存在返回-1

      如:demo_1, test_u_2
      参数:
      dbName -
      返回:
    • findTableNameInSQL

      public static final String findTableNameInSQL(String createTableSQL) throws DatabaseException
      从创建表的SQL中找出表名
      参数:
      createTableSQL -
      返回:
      抛出:
      DatabaseException
    • findIndexNameInSQL

      public static String findIndexNameInSQL(String createTableSQL) throws DatabaseException
      找到SQL语句中的索引名字,如果是创建索引语句的话
      参数:
      createTableSQL -
      返回:
      抛出:
      DatabaseException
    • findTableNameInIndex

      public static final String findTableNameInIndex(String sql)
      返回创建索引SQL中的表名称
      参数:
      sql -
      返回:
    • isCreateTableSQL

      public static boolean isCreateTableSQL(String sql)
      是个创建表结构的SQL语句
      参数:
      sql -
      返回:
    • isCreateIndexSQL

      public static boolean isCreateIndexSQL(String sql)
      是个创建索引的SQL语句
      参数:
      sql -
      返回:
    • manualCreatePhysicalTable

      public static boolean manualCreatePhysicalTable(DatabaseConnector connector, String createSQL, String tableName, String business) throws DatabaseException
      手动创建物理表数据,在存在元数据的情况下,物理表不存在,需要通过该方法创建。
      参数:
      connector -
      createSQL -
      tableName - 缺失的表名,如:rec_main_consume_709
      business - 业务参数,如:customerCode
      返回:
      抛出:
      DatabaseException
    • main

      public static void main(String[] args) throws Exception
      抛出:
      Exception