(ToSqlOptions options)
| 86 | } |
| 87 | |
| 88 | @Override |
| 89 | public String toSql(ToSqlOptions options) { |
| 90 | if (!options.showRewritten() && sqlString_ != null) return sqlString_; |
| 91 | |
| 92 | StringBuilder b = new StringBuilder(); |
| 93 | b.append("UPDATE "); |
| 94 | |
| 95 | if (fromClause_ == null) { |
| 96 | b.append(targetTableRef_.toSql(options)); |
| 97 | } else { |
| 98 | if (targetTableRef_.hasExplicitAlias()) { |
| 99 | b.append(targetTableRef_.getExplicitAlias()); |
| 100 | } else { |
| 101 | b.append(targetTableRef_.toSql(options)); |
| 102 | } |
| 103 | } |
| 104 | b.append(" SET"); |
| 105 | |
| 106 | boolean first = true; |
| 107 | for (Pair<SlotRef, Expr> i : assignments_) { |
| 108 | if (!first) { |
| 109 | b.append(","); |
| 110 | } else { |
| 111 | first = false; |
| 112 | } |
| 113 | b.append(format(" %s = %s", i.first.toSql(options), i.second.toSql(options))); |
| 114 | } |
| 115 | |
| 116 | b.append(fromClause_.toSql(options)); |
| 117 | |
| 118 | if (wherePredicate_ != null) { |
| 119 | b.append(" WHERE "); |
| 120 | b.append(wherePredicate_.toSql(options)); |
| 121 | } |
| 122 | return b.toString(); |
| 123 | } |
| 124 | |
| 125 | // Rewrite or create WHERE predicate to filter out rows that already have the desired |
| 126 | // value, thus skipping unnecessary updates. |
nothing calls this directly
no test coverage detected