예제 #1
0
  void run(Connection connection) throws SQLException {
    Database database = connection.database();
    DatabaseVendor vendor = database.vendor();

    String sql =
        "CREATE "
            + (unique ? "UNIQUE " : "")
            + "INDEX "
            + vendor.quote((unique ? "UNQ_" : "IDX_") + table.name() + "_" + id)
            + " "
            + "ON "
            + database.tableName(table.name())
            + "("
            + formatIndexFields(vendor)
            + ")"
            + getTableSpace(connection);

    Statement.executeUpdate(connection, sql);
  }
예제 #2
0
 private static void dropIndexSQLServer(Connection connection, String tableName, String indexName)
     throws SQLException {
   DatabaseVendor vendor = connection.vendor();
   String sql = "drop index " + vendor.quote(tableName) + "." + vendor.quote(indexName);
   Statement.executeUpdate(connection, sql);
 }
예제 #3
0
 private String formatIndexFields(DatabaseVendor vendor) {
   return vendor.quote(this.field.name());
 }