use of com.alibaba.druid.sql.ast.SQLCommentHint in project druid by alibaba.
the class MySqlOutputVisitor method visit.
@Override
public boolean visit(MySqlDeleteStatement x) {
print0(ucase ? "DELETE " : "delete ");
for (int i = 0, size = x.getHintsSize(); i < size; ++i) {
SQLCommentHint hint = x.getHints().get(i);
hint.accept(this);
print(' ');
}
if (x.isLowPriority()) {
print0(ucase ? "LOW_PRIORITY " : "low_priority ");
}
if (x.isQuick()) {
print0(ucase ? "QUICK " : "quick ");
}
if (x.isIgnore()) {
print0(ucase ? "IGNORE " : "ignore ");
}
if (x.getFrom() == null) {
print0(ucase ? "FROM " : "from ");
x.getTableSource().accept(this);
} else {
x.getTableSource().accept(this);
println();
print0(ucase ? "FROM " : "from ");
x.getFrom().accept(this);
}
if (x.getUsing() != null) {
println();
print0(ucase ? "USING " : "using ");
x.getUsing().accept(this);
}
if (x.getWhere() != null) {
println();
incrementIndent();
print0(ucase ? "WHERE " : "where ");
x.getWhere().setParent(x);
x.getWhere().accept(this);
decrementIndent();
}
if (x.getOrderBy() != null) {
println();
x.getOrderBy().accept(this);
}
if (x.getLimit() != null) {
println();
x.getLimit().accept(this);
}
return false;
}
use of com.alibaba.druid.sql.ast.SQLCommentHint in project druid by alibaba.
the class MySqlOutputVisitor method visit.
public boolean visit(MySqlSelectQueryBlock x) {
if (x.getOrderBy() != null) {
x.getOrderBy().setParent(x);
}
print0(ucase ? "SELECT " : "select ");
for (int i = 0, size = x.getHintsSize(); i < size; ++i) {
SQLCommentHint hint = x.getHints().get(i);
hint.accept(this);
print(' ');
}
if (SQLSetQuantifier.ALL == x.getDistionOption()) {
print0(ucase ? "ALL " : "all ");
} else if (SQLSetQuantifier.DISTINCT == x.getDistionOption()) {
print0(ucase ? "DISTINCT " : "distinct ");
} else if (SQLSetQuantifier.DISTINCTROW == x.getDistionOption()) {
print0(ucase ? "DISTINCTROW " : "distinctrow ");
}
if (x.isHignPriority()) {
print0(ucase ? "HIGH_PRIORITY " : "high_priority ");
}
if (x.isStraightJoin()) {
print0(ucase ? "STRAIGHT_JOIN " : "straight_join ");
}
if (x.isSmallResult()) {
print0(ucase ? "SQL_SMALL_RESULT " : "sql_small_result ");
}
if (x.isBigResult()) {
print0(ucase ? "SQL_BIG_RESULT " : "sql_big_result ");
}
if (x.isBufferResult()) {
print0(ucase ? "SQL_BUFFER_RESULT " : "sql_buffer_result ");
}
if (x.getCache() != null) {
if (x.getCache().booleanValue()) {
print0(ucase ? "SQL_CACHE " : "sql_cache ");
} else {
print0(ucase ? "SQL_NO_CACHE " : "sql_no_cache ");
}
}
if (x.isCalcFoundRows()) {
print0(ucase ? "SQL_CALC_FOUND_ROWS " : "sql_calc_found_rows ");
}
printSelectList(x.getSelectList());
if (x.getInto() != null) {
println();
print0(ucase ? "INTO " : "into ");
x.getInto().accept(this);
}
if (x.getFrom() != null) {
println();
print0(ucase ? "FROM " : "from ");
x.getFrom().accept(this);
}
if (x.getWhere() != null) {
println();
print0(ucase ? "WHERE " : "where ");
x.getWhere().setParent(x);
x.getWhere().accept(this);
}
if (x.getGroupBy() != null) {
println();
x.getGroupBy().accept(this);
}
if (x.getOrderBy() != null) {
println();
x.getOrderBy().accept(this);
}
if (x.getLimit() != null) {
println();
x.getLimit().accept(this);
}
if (x.getProcedureName() != null) {
print0(ucase ? " PROCEDURE " : " procedure ");
x.getProcedureName().accept(this);
if (!x.getProcedureArgumentList().isEmpty()) {
print('(');
printAndAccept(x.getProcedureArgumentList(), ", ");
print(')');
}
}
if (x.isForUpdate()) {
println();
print0(ucase ? "FOR UPDATE" : "for update");
if (x.isNoWait()) {
print0(ucase ? " NO_WAIT" : " no_wait");
} else if (x.getWaitTime() != null) {
print0(ucase ? " WAIT " : " wait ");
x.getWaitTime().accept(this);
}
}
if (x.isLockInShareMode()) {
println();
print0(ucase ? "LOCK IN SHARE MODE" : "lock in share mode");
}
return false;
}
Aggregations