/** Package sqlObjects @author: Ismael H F Santos @version: 1.0 @see */ package sqlObjects; import java.sql.*; import java.util.*; public class Delete { Connection c; boolean status = false; public Delete (Connection c) { // Store connection object for later use this.c = c; } public Delete (Connection c, String sql) { try { Statement sqlStatement = c.createStatement(); sqlStatement.executeUpdate(sql); // set status to true this.status = true; } catch (SQLException e) { // Set status to false this.status = false; } } public void deleteAll (String table) { String sql; sql = "Delete from " + table; try { Statement sqlStatement = this.c.createStatement(); sqlStatement.executeUpdate(sql); // Set status to true for success this.status = true; } catch (SQLException e) { // set status to fail this.status = false; } } public boolean getSuccess () { // Get status variable return this.status; } }