equal
deleted
inserted
replaced
26 * |
26 * |
27 * @author Ing. František Kučera (frantovo.cz) |
27 * @author Ing. František Kučera (frantovo.cz) |
28 */ |
28 */ |
29 public abstract class SQLCommand { |
29 public abstract class SQLCommand { |
30 |
30 |
31 private COMMAND_TYPE commandType; |
|
32 private String query; |
31 private String query; |
33 |
32 |
34 public SQLCommand(COMMAND_TYPE commandType, String query) { |
33 public SQLCommand(String query) { |
35 this.commandType = commandType; |
|
36 this.query = query; |
34 this.query = query; |
37 } |
35 } |
38 |
36 |
39 public PreparedStatement prepareStatement(Connection c) throws SQLException { |
37 public PreparedStatement prepareStatement(Connection c) throws SQLException { |
40 return c.prepareStatement(query); |
38 return c.prepareStatement(query); |
42 |
40 |
43 public abstract void parametrize(PreparedStatement ps) throws SQLException; |
41 public abstract void parametrize(PreparedStatement ps) throws SQLException; |
44 |
42 |
45 public abstract List<? extends Parameter> getParameters(); |
43 public abstract List<? extends Parameter> getParameters(); |
46 |
44 |
47 public COMMAND_TYPE getCommandType() { |
|
48 return commandType; |
|
49 } |
|
50 |
|
51 public void setCommandType(COMMAND_TYPE commandType) { |
|
52 this.commandType = commandType; |
|
53 } |
|
54 |
|
55 public String getQuery() { |
45 public String getQuery() { |
56 return query; |
46 return query; |
57 } |
47 } |
58 |
|
59 public enum COMMAND_TYPE { |
|
60 |
|
61 /** SELECT */ |
|
62 QUERY, |
|
63 /** INSERT, UPDATE, DELETE */ |
|
64 UPDATE |
|
65 }; |
|
66 } |
48 } |