Skip to content

Commit fd25ab4

Browse files
committed
little housekeeping
1 parent c3ec64d commit fd25ab4

File tree

1 file changed

+82
-82
lines changed

1 file changed

+82
-82
lines changed

src/main/java/net/sf/jsqlparser/util/deparser/UpdateDeParser.java

Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -36,94 +36,94 @@
3636
*/
3737
public class UpdateDeParser {
3838

39-
private StringBuilder buffer;
40-
private ExpressionVisitor expressionVisitor;
41-
private SelectVisitor selectVisitor;
39+
private StringBuilder buffer;
40+
private ExpressionVisitor expressionVisitor;
41+
private SelectVisitor selectVisitor;
4242

43-
/**
44-
* @param expressionVisitor a {@link ExpressionVisitor} to de-parse
45-
* expressions. It has to share the same<br>
46-
* StringBuilder (buffer parameter) as this object in order to work
47-
* @param selectVisitor a {@link SelectVisitor} to de-parse
48-
* {@link net.sf.jsqlparser.statement.select.Select}s. It has to share the
49-
* same<br>
50-
* StringBuilder (buffer parameter) as this object in order to work
51-
* @param buffer the buffer that will be filled with the select
52-
*/
53-
public UpdateDeParser(ExpressionVisitor expressionVisitor, SelectVisitor selectVisitor, StringBuilder buffer) {
54-
this.buffer = buffer;
55-
this.expressionVisitor = expressionVisitor;
56-
this.selectVisitor = selectVisitor;
57-
}
43+
/**
44+
* @param expressionVisitor a {@link ExpressionVisitor} to de-parse
45+
* expressions. It has to share the same<br>
46+
* StringBuilder (buffer parameter) as this object in order to work
47+
* @param selectVisitor a {@link SelectVisitor} to de-parse
48+
* {@link net.sf.jsqlparser.statement.select.Select}s. It has to share the
49+
* same<br>
50+
* StringBuilder (buffer parameter) as this object in order to work
51+
* @param buffer the buffer that will be filled with the select
52+
*/
53+
public UpdateDeParser(ExpressionVisitor expressionVisitor, SelectVisitor selectVisitor, StringBuilder buffer) {
54+
this.buffer = buffer;
55+
this.expressionVisitor = expressionVisitor;
56+
this.selectVisitor = selectVisitor;
57+
}
5858

59-
public StringBuilder getBuffer() {
60-
return buffer;
61-
}
59+
public StringBuilder getBuffer() {
60+
return buffer;
61+
}
6262

63-
public void setBuffer(StringBuilder buffer) {
64-
this.buffer = buffer;
65-
}
63+
public void setBuffer(StringBuilder buffer) {
64+
this.buffer = buffer;
65+
}
6666

67-
public void deParse(Update update) {
68-
buffer.append("UPDATE ").append(PlainSelect.getStringList(update.getTables(), true, false)).append(" SET ");
69-
70-
if (!update.isUseSelect()) {
71-
for (int i = 0; i < update.getColumns().size(); i++) {
72-
Column column = update.getColumns().get(i);
73-
buffer.append(column.getFullyQualifiedName()).append(" = ");
74-
75-
Expression expression = update.getExpressions().get(i);
76-
expression.accept(expressionVisitor);
77-
if (i < update.getColumns().size() - 1) {
78-
buffer.append(", ");
79-
}
80-
}
81-
} else {
82-
if (update.isUseColumnsBrackets()) {
83-
buffer.append("(");
84-
}
85-
for (int i = 0; i < update.getColumns().size(); i++) {
86-
if (i != 0) {
87-
buffer.append(", ");
88-
}
89-
Column column = update.getColumns().get(i);
90-
buffer.append(column.getFullyQualifiedName());
91-
}
92-
if (update.isUseColumnsBrackets()) {
93-
buffer.append(")");
94-
}
95-
buffer.append(" = ");
96-
buffer.append("(");
97-
Select select = update.getSelect();
98-
select.getSelectBody().accept(selectVisitor);
99-
buffer.append(")");
100-
}
101-
102-
if (update.getFromItem() != null) {
103-
buffer.append(" FROM ").append(update.getFromItem());
104-
if (update.getJoins() != null) {
105-
for (Join join : update.getJoins()) {
106-
if (join.isSimple()) {
107-
buffer.append(", ").append(join);
108-
} else {
109-
buffer.append(" ").append(join);
110-
}
111-
}
112-
}
113-
}
67+
public void deParse(Update update) {
68+
buffer.append("UPDATE ").append(PlainSelect.getStringList(update.getTables(), true, false)).append(" SET ");
11469

115-
if (update.getWhere() != null) {
116-
buffer.append(" WHERE ");
117-
update.getWhere().accept(expressionVisitor);
118-
}
70+
if (!update.isUseSelect()) {
71+
for (int i = 0; i < update.getColumns().size(); i++) {
72+
Column column = update.getColumns().get(i);
73+
buffer.append(column.getFullyQualifiedName()).append(" = ");
11974

120-
}
75+
Expression expression = update.getExpressions().get(i);
76+
expression.accept(expressionVisitor);
77+
if (i < update.getColumns().size() - 1) {
78+
buffer.append(", ");
79+
}
80+
}
81+
} else {
82+
if (update.isUseColumnsBrackets()) {
83+
buffer.append("(");
84+
}
85+
for (int i = 0; i < update.getColumns().size(); i++) {
86+
if (i != 0) {
87+
buffer.append(", ");
88+
}
89+
Column column = update.getColumns().get(i);
90+
buffer.append(column.getFullyQualifiedName());
91+
}
92+
if (update.isUseColumnsBrackets()) {
93+
buffer.append(")");
94+
}
95+
buffer.append(" = ");
96+
buffer.append("(");
97+
Select select = update.getSelect();
98+
select.getSelectBody().accept(selectVisitor);
99+
buffer.append(")");
100+
}
121101

122-
public ExpressionVisitor getExpressionVisitor() {
123-
return expressionVisitor;
124-
}
102+
if (update.getFromItem() != null) {
103+
buffer.append(" FROM ").append(update.getFromItem());
104+
if (update.getJoins() != null) {
105+
for (Join join : update.getJoins()) {
106+
if (join.isSimple()) {
107+
buffer.append(", ").append(join);
108+
} else {
109+
buffer.append(" ").append(join);
110+
}
111+
}
112+
}
113+
}
125114

126-
public void setExpressionVisitor(ExpressionVisitor visitor) {
127-
expressionVisitor = visitor;
128-
}
115+
if (update.getWhere() != null) {
116+
buffer.append(" WHERE ");
117+
update.getWhere().accept(expressionVisitor);
118+
}
119+
120+
}
121+
122+
public ExpressionVisitor getExpressionVisitor() {
123+
return expressionVisitor;
124+
}
125+
126+
public void setExpressionVisitor(ExpressionVisitor visitor) {
127+
expressionVisitor = visitor;
128+
}
129129
}

0 commit comments

Comments
 (0)