Java Code Examples for com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor#setShardingSupport()

The following examples show how to use com.alibaba.druid.sql.dialect.mysql.visitor.MySqlOutputVisitor#setShardingSupport() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MysqlVisitor.java    From dble with GNU General Public License v2.0 6 votes vote down vote up
void buildTableName(TableNode tableNode, StringBuilder sb) {
    String tableName = "`" + tableNode.getPureName() + "`";
    String fullName = "`" + tableNode.getPureSchema() + "`." + tableName;
    mapTableToSimple.put(fullName, tableName);
    sb.append(" ").append(fullName);
    String alias = tableNode.getAlias();
    if (alias != null) {
        sb.append(" `").append(alias).append("`");
    }
    List<SQLHint> hintList = tableNode.getHintList();
    if (hintList != null && !hintList.isEmpty()) {
        sb.append(' ');
        boolean isFirst = true;
        for (SQLHint hint : hintList) {
            if (isFirst)
                isFirst = false;
            else
                sb.append(" ");
            MySqlOutputVisitor ov = new MySqlOutputVisitor(sb);
            ov.setShardingSupport(false);
            hint.accept(ov);
        }
    }
}
 
Example 2
Source File: MySQLItemVisitor.java    From dble with GNU General Public License v2.0 5 votes vote down vote up
private void initName(SQLExpr expr) {
    StringBuilder sb = new StringBuilder();
    MySqlOutputVisitor ov = new MySqlOutputVisitor(sb);
    ov.setShardingSupport(false);
    expr.accept(ov);
    item.setItemName(sb.toString());
}
 
Example 3
Source File: Item.java    From dble with GNU General Public License v2.0 5 votes vote down vote up
public final String getItemName() {
    if (itemName == null || itemName.length() == 0) {
        SQLExpr expr = toExpression();
        StringBuilder sb = new StringBuilder();
        MySqlOutputVisitor ov = new MySqlOutputVisitor(sb);
        ov.setShardingSupport(false);
        expr.accept(ov);
        itemName = sb.toString();
    }
    return itemName;
}
 
Example 4
Source File: DefaultDruidParser.java    From dble with GNU General Public License v2.0 5 votes vote down vote up
String statementToString(SQLStatement statement) {
    StringBuffer buf = new StringBuffer();
    MySqlOutputVisitor visitor = new MySqlOutputVisitor(buf);
    visitor.setShardingSupport(false);
    statement.accept(visitor);
    return buf.toString();
}