1 | |
package liquibase.statement.core; |
2 | |
|
3 | |
import java.util.ArrayList; |
4 | |
import java.util.Arrays; |
5 | |
import java.util.List; |
6 | |
import java.util.Map; |
7 | |
import java.util.SortedMap; |
8 | |
import java.util.TreeMap; |
9 | |
|
10 | |
import liquibase.statement.AbstractSqlStatement; |
11 | |
|
12 | |
public class UpdateStatement extends AbstractSqlStatement { |
13 | |
private String schemaName; |
14 | |
private String tableName; |
15 | 18 | private SortedMap<String, Object> newColumnValues = new TreeMap<String, Object>(); |
16 | |
private String whereClause; |
17 | 18 | private List<Object> whereParameters = new ArrayList<Object>(); |
18 | |
|
19 | 18 | public UpdateStatement(String schemaName, String tableName) { |
20 | 18 | this.schemaName = schemaName; |
21 | 18 | this.tableName = tableName; |
22 | 18 | } |
23 | |
|
24 | |
public String getSchemaName() { |
25 | 4 | return schemaName; |
26 | |
} |
27 | |
|
28 | |
public String getTableName() { |
29 | 19 | return tableName; |
30 | |
} |
31 | |
|
32 | |
public UpdateStatement addNewColumnValue(String columnName, Object newValue) { |
33 | 17 | newColumnValues.put(columnName, newValue); |
34 | |
|
35 | 17 | return this; |
36 | |
} |
37 | |
|
38 | |
public String getWhereClause() { |
39 | 4 | return whereClause; |
40 | |
} |
41 | |
|
42 | |
public UpdateStatement setWhereClause(String whereClause) { |
43 | 2 | this.whereClause = whereClause; |
44 | |
|
45 | 2 | return this; |
46 | |
} |
47 | |
|
48 | |
public UpdateStatement addWhereParameter(Object value) { |
49 | 0 | this.whereParameters.add(value); |
50 | |
|
51 | 0 | return this; |
52 | |
} |
53 | |
|
54 | |
public UpdateStatement addWhereParameters(Object... value) { |
55 | 0 | this.whereParameters.addAll(Arrays.asList(value)); |
56 | |
|
57 | 0 | return this; |
58 | |
} |
59 | |
|
60 | |
public Map<String, Object> getNewColumnValues() { |
61 | 21 | return newColumnValues; |
62 | |
} |
63 | |
|
64 | |
public List<Object> getWhereParameters() { |
65 | 2 | return whereParameters; |
66 | |
} |
67 | |
} |