content: package com.alibaba.druid.bvt.sql.mysql.param;
  
  import com.alibaba.druid.DbType;
  import com.alibaba.druid.sql.SQLUtils;
  import com.alibaba.druid.sql.ast.SQLStatement;
  import com.alibaba.druid.sql.parser.SQLParserUtils;
  import com.alibaba.druid.sql.parser.SQLStatementParser;
  import com.alibaba.druid.sql.visitor.SQLASTOutputVisitor;
  import com.alibaba.druid.util.JdbcConstants;
  import junit.framework.TestCase;
  
  import java.util.ArrayList;
  import java.util.List;
  
  /**
   * Created by wenshao on 16/8/23.
   */
  public class MySqlParameterizedOutputVisitorTest_52_schema extends TestCase {
      public void test_for_parameterize() throws Exception {
          final DbType dbType = JdbcConstants.MYSQL;
          String sql = "UPDATE `buyer_0158`.xc_yy_order_1082\n" +
                  "SET `ALIPAY_BUYER_ID` = 1025, `GMT_MODIFIED` = 'aaaa'\n" +
                  "WHERE `PAY_ORDER_ID` = 'kkk'";
  
          SQLStatementParser parser = SQLParserUtils.createSQLStatementParser(sql, dbType);
          List<SQLStatement> stmtList = parser.parseStatementList();
          SQLStatement statement = stmtList.get(0);
  
          StringBuilder out = new StringBuilder();
          SQLASTOutputVisitor visitor = SQLUtils.createOutputVisitor(out, JdbcConstants.MYSQL);
          List<Object> parameters = new ArrayList<Object>();
          visitor.setParameterized(true);
          visitor.setParameterizedMergeInList(true);
          visitor.setParameters(parameters);
          /*visitor.setPrettyFormat(false);*/
          statement.accept(visitor);
         /* JSONArray array = new JSONArray();
          for(String table : visitor.getTables()){
              array.add(table.replaceAll("`",""));
          }*/
  
          String psql = out.toString();
  
          System.out.println(psql);
  
          assertEquals("UPDATE buyer.xc_yy_order\n" +
                  "SET `ALIPAY_BUYER_ID` = ?, `GMT_MODIFIED` = ?\n" +
                  "WHERE `PAY_ORDER_ID` = ?", psql);
      }
  }
  