use of com.alibaba.druid.sql.dialect.mysql.ast.MySqlObject in project druid by alibaba.
the class SQLUtils method toSQLString.
public static String toSQLString(SQLObject obj) {
if (obj instanceof SQLStatement) {
SQLStatement stmt = (SQLStatement) obj;
return toSQLString(stmt, stmt.getDbType());
}
if (obj instanceof MySqlObject) {
return toMySqlString(obj);
}
StringBuilder out = new StringBuilder();
obj.accept(new SQLASTOutputVisitor(out));
String sql = out.toString();
return sql;
}
use of com.alibaba.druid.sql.dialect.mysql.ast.MySqlObject in project druid by alibaba.
the class SQLObjectImpl method output.
public void output(Appendable buf) {
DbType dbType = null;
if (this instanceof OracleSQLObject) {
dbType = DbType.oracle;
} else if (this instanceof MySqlObject) {
dbType = DbType.mysql;
} else if (this instanceof PGSQLObject) {
dbType = DbType.postgresql;
} else if (this instanceof SQLDbTypedObject) {
dbType = ((SQLDbTypedObject) this).getDbType();
}
accept(SQLUtils.createOutputVisitor(buf, dbType));
}
Aggregations