예제 #1
0
  @Override
  protected DatabaseObject snapshotObject(DatabaseObject example, DatabaseSnapshot snapshot)
      throws DatabaseException {
    Database database = snapshot.getDatabase();
    String objectName = example.getName();
    Schema schema = example.getSchema();

    List<CachedRow> rs = null;
    try {
      JdbcDatabaseSnapshot.CachingDatabaseMetaData metaData =
          ((JdbcDatabaseSnapshot) snapshot).getMetaData();
      rs =
          metaData.getTables(
              ((AbstractJdbcDatabase) database).getJdbcCatalogName(schema),
              ((AbstractJdbcDatabase) database).getJdbcSchemaName(schema),
              database.correctObjectName(objectName, Table.class),
              new String[] {"TABLE"});

      Table table;
      if (rs.size() > 0) {
        table = readTable(rs.get(0), database);
      } else {
        return null;
      }

      return table;
    } catch (SQLException e) {
      throw new DatabaseException(e);
    }
  }
예제 #2
0
  @Override
  public boolean isSystemObject(DatabaseObject example) {
    if (example == null) {
      return false;
    }

    if (this.isLiquibaseObject(example)) {
      return false;
    }

    if (example instanceof Schema) {
      if ("SYSTEM".equals(example.getName())
          || "SYS".equals(example.getName())
          || "CTXSYS".equals(example.getName())
          || "XDB".equals(example.getName())) {
        return true;
      }
      if ("SYSTEM".equals(example.getSchema().getCatalogName())
          || "SYS".equals(example.getSchema().getCatalogName())
          || "CTXSYS".equals(example.getSchema().getCatalogName())
          || "XDB".equals(example.getSchema().getCatalogName())) {
        return true;
      }
    } else if (isSystemObject(example.getSchema())) {
      return true;
    }
    if (example instanceof Catalog) {
      if (("SYSTEM".equals(example.getName())
          || "SYS".equals(example.getName())
          || "CTXSYS".equals(example.getName())
          || "XDB".equals(example.getName()))) {
        return true;
      }
    } else if (example instanceof Table) {
      if (example.getName().startsWith("BIN$")) { // oracle deleted table
        return true;
      } else if (example.getName().startsWith("AQ$")) { // oracle AQ tables
        return true;
      } else if (example.getName().startsWith("DR$")) { // oracle index tables
        return true;
      } else if (example.getName().startsWith("SYS_IOT_OVER")) { // oracle system table
        return true;
      }
    }

    return super.isSystemObject(example);
  }
예제 #3
0
  @Override
  public boolean isSystemObject(final DatabaseObject example) {
    if (example == null) {
      return false;
    }
    if (example.getSchema() != null
        && example.getSchema().getName() != null
        && example.getSchema().getName().equalsIgnoreCase("information_schema")) {
      return true;
    }
    if (example instanceof Table && getSystemTables().contains(example.getName())) {
      return true;
    }

    if (example instanceof View && getSystemViews().contains(example.getName())) {
      return true;
    }

    return false;
  }
예제 #4
0
  @Override
  public boolean isSystemObject(DatabaseObject example) {
    if (example == null) {
      return false;
    }

    if (this.isLiquibaseObject(example)) {
      return false;
    }

    if (example instanceof Schema) {
      if ("SYSTEM".equals(example.getName())
          || "SYS".equals(example.getName())
          || "CTXSYS".equals(example.getName())
          || "XDB".equals(example.getName())) {
        return true;
      }
      if ("SYSTEM".equals(example.getSchema().getCatalogName())
          || "SYS".equals(example.getSchema().getCatalogName())
          || "CTXSYS".equals(example.getSchema().getCatalogName())
          || "XDB".equals(example.getSchema().getCatalogName())) {
        return true;
      }
    } else if (isSystemObject(example.getSchema())) {
      return true;
    }
    if (example instanceof Catalog) {
      if (("SYSTEM".equals(example.getName())
          || "SYS".equals(example.getName())
          || "CTXSYS".equals(example.getName())
          || "XDB".equals(example.getName()))) {
        return true;
      }
    } else if (example.getName() != null) {
      if (example.getName().startsWith("BIN$")) { // oracle deleted table
        return true;
      } else if (example.getName().startsWith("AQ$")) { // oracle AQ tables
        return true;
      } else if (example.getName().startsWith("DR$")) { // oracle index tables
        return true;
      } else if (example.getName().startsWith("SYS_IOT_OVER")) { // oracle system table
        return true;
      } else if ((example.getName().startsWith("MDRT_") || example.getName().startsWith("MDRS_"))
          && example.getName().endsWith("$")) {
        // CORE-1768 - Oracle creates these for spatial indices and will remove them when the index
        // is removed.
        return true;
      } else if (example
          .getName()
          .startsWith(
              "MLOG$_")) { // Created by materliaized view logs for every table that is part of a
        // materialized view. Not available for DDL operations.
        return true;
      } else if (example
          .getName()
          .startsWith(
              "RUPD$_")) { // Created by materialized view log tables using primary keys. Not
        // available for DDL operations.
        return true;
      } else if (example.getName().startsWith("WM$_")) { // Workspace Manager backup tables.
        return true;
      } else if (example
          .getName()
          .equals(
              "CREATE$JAVA$LOB$TABLE")) { // This table contains the name of the Java object, the
        // date it was loaded, and has a BLOB column to store the
        // Java object.
        return true;
      } else if (example
          .getName()
          .equals("JAVA$CLASS$MD5$TABLE")) { // This is a hash table that tracks the loading of Java
        // objects into a schema.
        return true;
      }
    }

    return super.isSystemObject(example);
  }