@Override public DbExecution execute(Connection connection) { Confirm.checkConfirmed("DropSchema","drop all tables in the schema"); return super.execute(connection); }
protected void deleteAll(final Class<?> entityClass){ Confirm.execute(() -> dao.deleteAll(entityClass)); }
public static void checkConfirmed(String action,String reason) throws ConfirmException { if(!isConfirmed()){ throw new ConfirmException("Action '" + action + "' must be confirmed for the reason '" + reason + "', please use method '" + Confirm.class.getName() + ".execute(Action)' to execute it."); } }
public boolean drop(Map params) throws Exception { MetaDataSource mds = apiReader.readDb(params); return dsf.execWithResult(mds, (db) -> { return Confirm.executeWithResult(() -> { return db.cmdDropSchema(db.getMetadata().getDefaultSchemaName()).execute().success(); }); }); }
@Override public void truncate(Class<?> entityClass) { Args.notNull(entityClass,"entity class"); EntityMapping em = em(entityClass); Confirm.checkConfirmed("Dmo.truncate","may lost all the data in table '" + em.getTableName() + "'"); commandFactory().newTruncateEntityCommand(this, em).execute(); }
public static void checkConfirmed(String action) throws ConfirmException { if(!isConfirmed()){ throw new ConfirmException("Action '" + action + "' must be confirmed, please use method '" + Confirm.class.getName() + ".execute(Action)' to execute it."); } }
@Override protected boolean doExecute() { Confirm.checkConfirmed("dmo.cmdDropTable", "Will drop the table in db and lost all the data in table"); if(em.isRemote()){ return false; } if(!db.checkTableExists(em.getTable())) { return false; } execution = db.cmdDropTable(em.getTable()).execute(); return true; } }