当前位置: 首页>>代码示例>>Java>>正文


Java Statement.accept方法代码示例

本文整理汇总了Java中net.sf.jsqlparser.statement.Statement.accept方法的典型用法代码示例。如果您正苦于以下问题:Java Statement.accept方法的具体用法?Java Statement.accept怎么用?Java Statement.accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.jsqlparser.statement.Statement的用法示例。


在下文中一共展示了Statement.accept方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: modifyTableNames

import net.sf.jsqlparser.statement.Statement; //导入方法依赖的package包/类
public static String modifyTableNames(String sql,TableRenamer tableRenamer) 
{

	if(sql == null)
	{
		throw new IllegalArgumentException("sql is null");
	}
	
	Statement statement = null;
	try
	{
		statement = CCJSqlParserUtil.parse(sql);
	} 
	catch (JSQLParserException e) 
	{
		throw new IllegalArgumentException("Error when parsing sql:[" + sql+"]",e);
	}
	
	TableRenameVisitor tableRenameVisitor=new TableRenameVisitor(tableRenamer);
	statement.accept(tableRenameVisitor);
	return statement.toString();
}
 
开发者ID:sogou-biztech,项目名称:compass,代码行数:23,代码来源:TableRenameUtil.java

示例2: testMysqlQuote

import net.sf.jsqlparser.statement.Statement; //导入方法依赖的package包/类
public void testMysqlQuote() throws JSQLParserException {
	String statement = "SELECT `a.OWNERLASTNAME`, `OWNERFIRSTNAME` "
						+"FROM `ANTIQUEOWNERS` AS a, ANTIQUES AS b "
						+"WHERE b.BUYERID = a.OWNERID AND b.ITEM = 'Chair'";
	Statement parsed = parserManager.parse(new StringReader(statement));
	StatementDeParser deParser=new StatementDeParser(new StringBuffer());
	parsed.accept(deParser);
	
	assertEquals(statement, parsed.toString());
	assertEquals(statement, deParser.getBuffer().toString());
}
 
开发者ID:UBOdin,项目名称:jsqlparser,代码行数:12,代码来源:SelectTest.java

示例3: testConcat

import net.sf.jsqlparser.statement.Statement; //导入方法依赖的package包/类
public void testConcat() throws JSQLParserException {
	String statement = "SELECT a || b || c + 4 FROM t";
	Statement parsed = parserManager.parse(new StringReader(statement));
	StatementDeParser deParser=new StatementDeParser(new StringBuffer());
	parsed.accept(deParser);
	
	assertEquals(statement, parsed.toString());
	assertEquals(statement, deParser.getBuffer().toString());
}
 
开发者ID:UBOdin,项目名称:jsqlparser,代码行数:10,代码来源:SelectTest.java

示例4: testMatches

import net.sf.jsqlparser.statement.Statement; //导入方法依赖的package包/类
public void testMatches() throws JSQLParserException {
	String statement = "SELECT * FROM team WHERE team.search_column @@ to_tsquery('new & york & yankees')";
	Statement parsed = parserManager.parse(new StringReader(statement));
	StatementDeParser deParser=new StatementDeParser(new StringBuffer());
	parsed.accept(deParser);
	
	assertEquals(statement, parsed.toString());
	assertEquals(statement, deParser.getBuffer().toString());
}
 
开发者ID:UBOdin,项目名称:jsqlparser,代码行数:10,代码来源:SelectTest.java

示例5: testGroupByExpression

import net.sf.jsqlparser.statement.Statement; //导入方法依赖的package包/类
public void testGroupByExpression() throws JSQLParserException {
	String statement = 
	"SELECT col1, col2, col1 + col2, sum(col8)" +
	" FROM table1 " +
	"GROUP BY col1, col2, col1 + col2";
	Statement parsed = parserManager.parse(new StringReader(statement));
	StatementDeParser deParser=new StatementDeParser(new StringBuffer());
	parsed.accept(deParser);
	
	assertEquals(statement, parsed.toString());
	assertEquals(statement, deParser.getBuffer().toString());
}
 
开发者ID:UBOdin,项目名称:jsqlparser,代码行数:13,代码来源:SelectTest.java

示例6: testBitwise

import net.sf.jsqlparser.statement.Statement; //导入方法依赖的package包/类
public void testBitwise() throws JSQLParserException {
	String statement = 
	"SELECT col1 & 32, col2 ^ col1, col1 | col2" +
	" FROM table1";
	Statement parsed = parserManager.parse(new StringReader(statement));
	StatementDeParser deParser=new StatementDeParser(new StringBuffer());
	parsed.accept(deParser);
	
	assertEquals(statement, parsed.toString());
	assertEquals(statement, deParser.getBuffer().toString());
}
 
开发者ID:UBOdin,项目名称:jsqlparser,代码行数:12,代码来源:SelectTest.java

示例7: testMysqlQuote

import net.sf.jsqlparser.statement.Statement; //导入方法依赖的package包/类
@Test
public void testMysqlQuote() throws JSQLParserException {
    String statement = "SELECT `a.OWNERLASTNAME`, `OWNERFIRSTNAME` "
            + "FROM `ANTIQUEOWNERS` AS a, ANTIQUES AS b "
            + "WHERE b.BUYERID = a.OWNERID AND b.ITEM = 'Chair'";
    Statement parsed = parserManager.parse(new StringReader(statement));
    StatementDeParser deParser = new StatementDeParser(new StringBuilder());
    parsed.accept(deParser);

    assertEquals(statement, parsed.toString());
    assertEquals(statement.toLowerCase(), deParser.getBuffer().toString().replaceAll("[\r\n]+", "").toLowerCase());
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:13,代码来源:SelectTest.java

示例8: testConcat

import net.sf.jsqlparser.statement.Statement; //导入方法依赖的package包/类
@Test
public void testConcat() throws JSQLParserException {
    String statement = "SELECT a || b || c + 4 FROM t";
    Statement parsed = parserManager.parse(new StringReader(statement));
    StatementDeParser deParser = new StatementDeParser(new StringBuilder());
    parsed.accept(deParser);

    assertEquals(statement, parsed.toString());
    assertEquals(statement.toLowerCase(), deParser.getBuffer().toString().replaceAll("[\r\n]+", "").toLowerCase());
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:11,代码来源:SelectTest.java

示例9: testMatches

import net.sf.jsqlparser.statement.Statement; //导入方法依赖的package包/类
@Test
public void testMatches() throws JSQLParserException {
    String statement = "SELECT * FROM team WHERE team.search_column @@ to_tsquery('new & york & yankees')";
    Statement parsed = parserManager.parse(new StringReader(statement));
    StatementDeParser deParser = new StatementDeParser(new StringBuilder());
    parsed.accept(deParser);

    assertEquals(statement, parsed.toString());
    assertEquals(statement.toLowerCase(), deParser.getBuffer().toString().replaceAll("[\r\n]+", "").toLowerCase());
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:11,代码来源:SelectTest.java

示例10: testGroupByExpression

import net.sf.jsqlparser.statement.Statement; //导入方法依赖的package包/类
@Test
public void testGroupByExpression() throws JSQLParserException {
    String statement =
            "SELECT col1, col2, col1 + col2, sum(col8)"
            + " FROM table1 "
            + "GROUP BY col1, col2, col1 + col2";
    Statement parsed = parserManager.parse(new StringReader(statement));
    StatementDeParser deParser = new StatementDeParser(new StringBuilder());
    parsed.accept(deParser);

    assertEquals(statement, parsed.toString());
    assertEquals(statement.toLowerCase(), deParser.getBuffer().toString().replaceAll("[\r\n]+", "").toLowerCase());
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:14,代码来源:SelectTest.java

示例11: testBitwise

import net.sf.jsqlparser.statement.Statement; //导入方法依赖的package包/类
@Test
public void testBitwise() throws JSQLParserException {
    String statement =
            "SELECT col1 & 32, col2 ^ col1, col1 | col2"
            + " FROM table1";
    Statement parsed = parserManager.parse(new StringReader(statement));
    StatementDeParser deParser = new StatementDeParser(new StringBuilder());
    parsed.accept(deParser);

    assertEquals(statement, parsed.toString());
    assertEquals(statement.toLowerCase(), deParser.getBuffer().toString().replaceAll("[\r\n]+", "").toLowerCase());
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:13,代码来源:SelectTest.java

示例12: revert

import net.sf.jsqlparser.statement.Statement; //导入方法依赖的package包/类
protected String revert(Statement statement) {
    StatementDeParser deParser = new StatementDeParser(new StringBuilder());
    statement.accept(deParser);
    return deParser.getBuffer().toString();
}
 
开发者ID:devpage,项目名称:sharding-quickstart,代码行数:6,代码来源:AbstractTableRouter.java

示例13: execute

import net.sf.jsqlparser.statement.Statement; //导入方法依赖的package包/类
public FindIterable<Document> execute(String SQL) throws JSQLParserException {
	Statement statement = CCJSqlParserUtil.parse(SQL);

	SQLVisitor visitor = new SQLVisitor();
	statement.accept(visitor);

	Query noQuery = visitor.getNoQuery();

	if (logger.isDebugEnabled() && outputQuery) {
		logger.debug(noQuery);
	}

	ArrayList<String> tables = Lists.newArrayList(noQuery.getTables().getTableNames());

	MongoCollection<Document> collection = db.getCollection(tables.get(0));

	QueryWhere where = noQuery.getWhere();

	QueryColumn columns = noQuery.getColumns();

	return collection.find(where.getFilter()).projection(columns.getColumns(tables.get(0)));
}
 
开发者ID:ormanli,项目名称:SQL2NoSQL,代码行数:23,代码来源:SQLExecuter.java

示例14: getTableList

import net.sf.jsqlparser.statement.Statement; //导入方法依赖的package包/类
/**
 * Main entry for this Tool class. A list of found tables is returned.
 *
 * @param delete
 * @return
 */
public List<String> getTableList(Statement statement) {
    init();
    statement.accept(this);
    return tables;
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:12,代码来源:TablesNamesFinder.java

示例15: doDeParse

import net.sf.jsqlparser.statement.Statement; //导入方法依赖的package包/类
/**
 * 将Statement反解析为sql
 * 
 * @param statement
 * @return
 */
protected String doDeParse(Statement statement) {
    StatementDeParser deParser = new StatementDeParser(new StringBuilder());
    statement.accept(deParser);
    return deParser.getBuffer().toString();
}
 
开发者ID:lysu,项目名称:mybatis-shard,代码行数:12,代码来源:AbstractSqlConverter.java


注:本文中的net.sf.jsqlparser.statement.Statement.accept方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。