Não estou conseguindo fazer o TRUNCATE ser lançado no JTextArea em tempo real.
O que eu estou fazendo de errado? Já tentei “inclusive” com uma Thread() mas mesmo assim não funcionou. Poderiam me ajudar?
private void executaTruncate() throws SQLException, ClassNotFoundException, InterruptedException {
//CONEXÃO COM BD FUNCIONANDO NORMALMENTE
con = cbd.conectarBD();
sql = "SELECT table_name AS tabela FROM information_schema.tables WHERE table_name <> 'usuarios' AND table_schema = 'permissoes'";
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
String truncate = null;
while (rs.next() == true) {
//ELE EXECUTA O TRUNCATE NORMALMENTE
truncate = "TRUNCATE " + rs.getString("tabela");
ps = con.prepareStatement(truncate);
ps.executeUpdate(truncate);
//INICIO DOS MEUS PROBLEMAS
Timer t = new Timer(20, (ActionEvent e) -> {
try {
v_Console.append("Apagando a tabela ==> [" + rs.getString("tabela") + "]");
} catch (SQLException ex) {
msg.falha("Falha na contagem do Timer.\nMotivo: " + ex);
}
});
t.start();
}
con.close();
}
Agradeço a ajuda e a atenção!
Obs.: procurei em alguns tópicos mas não encontrei nada parecido.