Ejemplo n.º 1
0
 @Override
 public void create(boolean ignoreAlreadyExists) throws SQLException {
   super.create(ignoreAlreadyExists);
   PreparedStatement ps =
       yordifier
           .getConnection()
           .prepareStatement(
               "INSERT INTO "
                   + Yordifier.TRIGGERS
                   + " (NAME, FUNCTION_NAME, TABLE_NAME) VALUES (?, ?, ?)");
   ps.setString(1, name);
   ps.setString(2, procedure.getName());
   ps.setString(3, table);
   ps.execute();
 }
Ejemplo n.º 2
0
  @Override
  public void drop(boolean ignoreDoesNotExist) throws SQLException {
    try {
      super.drop(ignoreDoesNotExist);
    } catch (SQLException ex) {
      if (ex.getSQLState().equals("42P01")) {
        // the triggers table does not exist anymore
        // ignore...
      } else {
        throw ex;
      }
    }

    PreparedStatement ps =
        yordifier
            .getConnection()
            .prepareStatement("DELETE FROM " + Yordifier.TRIGGERS.getName() + " WHERE NAME = ?");
    ps.setString(1, name);
    ps.execute();
  }