net.sf.aguacate.context.spi.sql.impl.SentenceSqlDelete Maven / Gradle / Ivy
package net.sf.aguacate.context.spi.sql.impl;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.sf.aguacate.function.FunctionContext;
import net.sf.aguacate.function.FunctionEvalResult;
public class SentenceSqlDelete extends AbstractSentenceSql {
private static final Logger LOGGER = LogManager.getLogger(SentenceSqlDelete.class);
private final String table;
private final String[] required;
private final String[] optional;
public SentenceSqlDelete(String name, String message, String table, List methods, List required,
List optional) {
super(name, message, methods);
this.table = table;
this.required = required.toArray(new String[required.size()]);
this.optional = optional.toArray(new String[optional.size()]);
}
@Override
public FunctionEvalResult evaluate0(FunctionContext functionContext, Map context)
throws SQLException {
int count = functionContext.databaseInterface().executeDelete(functionContext.acquireConnection(), table,
context, required, optional);
if (LOGGER.isInfoEnabled()) {
LOGGER.debug("deleted: {}", count);
}
return SUCCESS;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy