8
5
import java.util.regex.Matcher;
9
6
import java.util.regex.Pattern;
13
9
* Stores column information.
16
* @version $Id: PgColumn.java 80 2007-09-01 20:25:45Z fordfrog $
18
13
public class PgColumn {
20
16
* Pattern for parsing NULL arguments.
22
18
private static final Pattern PATTERN_NULL =
23
Pattern.compile("^(.+)[\\s]+NULL$", Pattern.CASE_INSENSITIVE);
19
Pattern.compile("^(.+)[\\s]+NULL$", Pattern.CASE_INSENSITIVE);
26
21
* Pattern for parsing NOT NULL arguments.
28
private static final Pattern PATTERN_NOT_NULL =
29
Pattern.compile("^(.+)[\\s]+NOT[\\s]+NULL$", Pattern.CASE_INSENSITIVE);
23
private static final Pattern PATTERN_NOT_NULL = Pattern.compile(
24
"^(.+)[\\s]+NOT[\\s]+NULL$", Pattern.CASE_INSENSITIVE);
32
26
* Pattern for parsing DEFAULT value.
34
private static final Pattern PATTERN_DEFAULT =
36
"^(.+)[\\s]+DEFAULT[\\s]+(.+)$",
37
Pattern.CASE_INSENSITIVE);
28
private static final Pattern PATTERN_DEFAULT = Pattern.compile(
29
"^(.+)[\\s]+DEFAULT[\\s]+(.+)$", Pattern.CASE_INSENSITIVE);
40
31
* Specific statistics value.
42
33
private Integer statistics;
45
35
* Default value of the column.
47
37
private String defaultValue;
50
39
* Name of the column.
52
41
private String name;
55
43
* Type of the column.
57
45
private String type;
60
47
* Determines whether null value is allowed in the column.
98
85
* @return full definition of the column
100
public String getFullDefinition(
101
final boolean quoteName,
102
final boolean addDefaults) {
87
public String getFullDefinition(final boolean quoteName,
88
final boolean addDefaults) {
103
89
final StringBuilder sbDefinition = new StringBuilder();
104
90
sbDefinition.append(PgDiffUtils.getQuotedName(name, quoteName));
105
91
sbDefinition.append(' ');