MCPcopy Create free account
hub / github.com/apache/calcite / unparse

Method unparse

core/src/main/java/org/apache/calcite/sql/SqlUpdate.java:180–209  ·  view source on GitHub ↗
(SqlWriter writer, int leftPrec, int rightPrec)

Source from the content-addressed store, hash-verified

178 }
179
180 @Override public void unparse(SqlWriter writer, int leftPrec, int rightPrec) {
181 final SqlWriter.Frame frame =
182 writer.startList(SqlWriter.FrameTypeEnum.SELECT, "UPDATE", "");
183 final int opLeft = getOperator().getLeftPrec();
184 final int opRight = getOperator().getRightPrec();
185 targetTable.unparse(writer, opLeft, opRight);
186 SqlIdentifier alias = this.alias;
187 if (alias != null) {
188 writer.keyword("AS");
189 alias.unparse(writer, opLeft, opRight);
190 }
191 final SqlWriter.Frame setFrame =
192 writer.startList(SqlWriter.FrameTypeEnum.UPDATE_SET_LIST, "SET", "");
193 for (Pair<SqlNode, SqlNode> pair
194 : Pair.zip(getTargetColumnList(), getSourceExpressionList())) {
195 writer.sep(",");
196 SqlIdentifier id = (SqlIdentifier) pair.left;
197 id.unparse(writer, opLeft, opRight);
198 writer.keyword("=");
199 SqlNode sourceExp = pair.right;
200 sourceExp.unparse(writer, opLeft, opRight);
201 }
202 writer.endList(setFrame);
203 SqlNode condition = this.condition;
204 if (condition != null) {
205 writer.sep("WHERE");
206 condition.unparse(writer, opLeft, opRight);
207 }
208 writer.endList(frame);
209 }
210
211 @Override public void validate(SqlValidator validator, SqlValidatorScope scope) {
212 validator.validateUpdate(this);

Callers

nothing calls this directly

Calls 12

getOperatorMethod · 0.95
unparseMethod · 0.95
zipMethod · 0.95
getTargetColumnListMethod · 0.95
unparseMethod · 0.95
getLeftPrecMethod · 0.80
getRightPrecMethod · 0.80
startListMethod · 0.65
keywordMethod · 0.65
sepMethod · 0.65
endListMethod · 0.65

Tested by

no test coverage detected