@Override
    @SuppressFBWarnings("SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE")
    public void deleteAll(final Connection _con)
        throws SQLException
    {
        final Statement stmtSel = _con.createStatement();
        final Statement stmtExec = _con.createStatement();

        try  {
            // remove all foreign keys
            if (DerbyDatabase.LOG.isInfoEnabled())  {
                DerbyDatabase.LOG.info("Remove all Foreign Keys");
            }
            ResultSet rs = stmtSel.executeQuery(DerbyDatabase.SELECT_ALL_KEYS);
            while (rs.next())  {
                final String tableName = rs.getString(1);
                final String constrName = rs.getString(2);
                if (DerbyDatabase.LOG.isDebugEnabled())  {
                    DerbyDatabase.LOG.debug("  - Table '" + tableName + "' Constraint '" + constrName + "'");
                }
                stmtExec.execute("alter table " + tableName + " drop constraint " + constrName);
            }
            rs.close();

            // remove all views
            if (DerbyDatabase.LOG.isInfoEnabled())  {
                DerbyDatabase.LOG.info("Remove all Views");
            }
            rs = stmtSel.executeQuery(DerbyDatabase.SELECT_ALL_VIEWS);
            while (rs.next())  {
                final String viewName = rs.getString(1);
                if (DerbyDatabase.LOG.isDebugEnabled())  {
                    DerbyDatabase.LOG.debug("  - View '" + viewName + "'");
                }
                stmtExec.execute("drop view " + viewName);
            }
            rs.close();

            // remove all tables
            if (DerbyDatabase.LOG.isInfoEnabled())  {
                DerbyDatabase.LOG.info("Remove all Tables");
            }
            rs = stmtSel.executeQuery(DerbyDatabase.SELECT_ALL_TABLES);
            while (rs.next())  {
                final String tableName = rs.getString(1);
                if (DerbyDatabase.LOG.isDebugEnabled())  {
                    DerbyDatabase.LOG.debug("  - Table '" + tableName + "'");
                }
                stmtExec.execute("drop table " + tableName);
            }
            rs.close();
        } finally  {
            stmtSel.close();
            stmtExec.close();
        }
    }
@ Override @ SuppressFBWarnings ( "SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE" ) public void deleteAll ( final Connection _con ) throws SQLException { final Statement stmtSel = _con . createStatement ( ) ; final Statement stmtExec = _con . createStatement ( ) ; try { if ( DerbyDatabase . LOG . isInfoEnabled ( ) ) { DerbyDatabase . LOG . info ( "Remove all Foreign Keys" ) ; } ResultSet rs = stmtSel . executeQuery ( DerbyDatabase . SELECT_ALL_KEYS ) ; while ( rs . next ( ) ) { final String tableName = rs . getString ( 1 ) ; final String constrName = rs . getString ( 2 ) ; if ( DerbyDatabase . LOG . isDebugEnabled ( ) ) { DerbyDatabase . LOG . debug ( "  - Table '" + tableName + "' Constraint '" + constrName + "'" ) ; } stmtExec . execute ( "alter table " + tableName + " drop constraint " + constrName ) ; } rs . close ( ) ; if ( DerbyDatabase . LOG . isInfoEnabled ( ) ) { DerbyDatabase . LOG . info ( "Remove all Views" ) ; } rs = stmtSel . executeQuery ( DerbyDatabase . SELECT_ALL_VIEWS ) ; while ( rs . next ( ) ) { final String viewName = rs . getString ( 1 ) ; if ( DerbyDatabase . LOG . isDebugEnabled ( ) ) { DerbyDatabase . LOG . debug ( "  - View '" + viewName + "'" ) ; } stmtExec . execute ( "drop view " + viewName ) ; } rs . close ( ) ; if ( DerbyDatabase . LOG . isInfoEnabled ( ) ) { DerbyDatabase . LOG . info ( "Remove all Tables" ) ; } rs = stmtSel . executeQuery ( DerbyDatabase . SELECT_ALL_TABLES ) ; while ( rs . next ( ) ) { final String tableName = rs . getString ( 1 ) ; if ( DerbyDatabase . LOG . isDebugEnabled ( ) ) { DerbyDatabase . LOG . debug ( "  - Table '" + tableName + "'" ) ; } stmtExec . execute ( "drop table " + tableName ) ; } rs . close ( ) ; } finally { stmtSel . close ( ) ; stmtExec . close ( ) ; } }
This is the Derby specific implementation of an all deletion. Following
order is used to remove all eFaps specific information:
<ul>
<li>remove all foreign keys of the user</li>
<li>remove all views of the user</li>
<li>remove all tables of the user</li>
</ul>
Attention! If application specific tables, views or constraints are
defined, this database objects are also removed!

@param _con  sql connection
@throws SQLException if remove of keys, views or tables failed