use of com.alibaba.cobar.parser.ast.fragment.Limit in project cobar by alibaba.
the class MySQLOutputASTVisitor method visit.
@Override
public void visit(ShowProfile node) {
appendable.append("SHOW PROFILE");
List<ShowProfile.Type> types = node.getTypes();
boolean isFst = true;
for (ShowProfile.Type type : types) {
if (isFst) {
isFst = false;
appendable.append(' ');
} else {
appendable.append(", ");
}
appendable.append(type.name().replace('_', ' '));
}
Expression query = node.getForQuery();
if (query != null) {
appendable.append(" FOR QUERY ");
query.accept(this);
}
Limit limit = node.getLimit();
if (limit != null) {
appendable.append(' ');
limit.accept(this);
}
}
use of com.alibaba.cobar.parser.ast.fragment.Limit in project cobar by alibaba.
the class MySQLOutputASTVisitor method visit.
@Override
public void visit(ShowBinLogEvent node) {
appendable.append("SHOW BINLOG EVENTS");
String logName = node.getLogName();
if (logName != null)
appendable.append(" IN ").append(logName);
Expression pos = node.getPos();
if (pos != null) {
appendable.append(" FROM ");
pos.accept(this);
}
Limit limit = node.getLimit();
if (limit != null) {
appendable.append(' ');
limit.accept(this);
}
}
use of com.alibaba.cobar.parser.ast.fragment.Limit in project cobar by alibaba.
the class MySQLOutputASTVisitor method visit.
@Override
public void visit(DMLUpdateStatement node) {
appendable.append("UPDATE ");
if (node.isLowPriority()) {
appendable.append("LOW_PRIORITY ");
}
if (node.isIgnore()) {
appendable.append("IGNORE ");
}
node.getTableRefs().accept(this);
appendable.append(" SET ");
boolean isFst = true;
for (Pair<Identifier, Expression> p : node.getValues()) {
if (isFst)
isFst = false;
else
appendable.append(", ");
p.getKey().accept(this);
appendable.append(" = ");
p.getValue().accept(this);
}
Expression where = node.getWhere();
if (where != null) {
appendable.append(" WHERE ");
where.accept(this);
}
OrderBy order = node.getOrderBy();
if (order != null) {
appendable.append(' ');
order.accept(this);
}
Limit limit = node.getLimit();
if (limit != null) {
appendable.append(' ');
limit.accept(this);
}
}
use of com.alibaba.cobar.parser.ast.fragment.Limit in project cobar by alibaba.
the class MySQLOutputASTVisitor method visit.
@Override
public void visit(ShowWarnings node) {
appendable.append("SHOW ");
if (node.isCount()) {
appendable.append("COUNT(*) WARNINGS");
} else {
appendable.append("WARNINGS");
Limit limit = node.getLimit();
if (limit != null) {
appendable.append(' ');
limit.accept(this);
}
}
}
Aggregations