1 /*
2 * Created on 25/Jan/2004
3 *
4 * To change the template for this generated file go to
5 * Window>Preferences>Java>Code Generation>Code and Comments
6 */
7 package replica.database.commands;
8
9 import java.sql.SQLException;
10 import java.sql.Statement;
11 import java.util.logging.Level;
12
13 import replica.server.commands.PrintCommand;
14
15 /***
16 * @author Pedro
17 *
18 * To change the template for this generated type comment go to
19 * Window>Preferences>Java>Code Generation>Code and Comments
20 */
21 public abstract class StatementDbCommand extends DatabaseCommand {
22
23 public Object execute(DatabaseCommandVO arg) {
24
25 logger.info("Received command : " + arg);
26
27 Statement st = null;
28 try{
29 st = arg.getConnection().createStatement();
30 return execute( st, arg.getCommand() );
31 }
32 catch(SQLException e){
33 getLogger().log(Level.WARNING, e.getMessage(), e);
34 return PrintCommand.NAME + " " + e.getMessage();
35 }
36 }
37
38 abstract protected Object execute(Statement st, String command) throws SQLException;
39 }
This page was automatically generated by Maven