本文整理汇总了Java中com.akiban.sql.parser.QueryTreeNode类的典型用法代码示例。如果您正苦于以下问题:Java QueryTreeNode类的具体用法?Java QueryTreeNode怎么用?Java QueryTreeNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
QueryTreeNode类属于com.akiban.sql.parser包,在下文中一共展示了QueryTreeNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: skipChildren
import com.akiban.sql.parser.QueryTreeNode; //导入依赖的package包/类
@Override
public boolean skipChildren(Visitable node) throws StandardException {
boolean tmp = false;
switch (((QueryTreeNode) node).getNodeType()) {
case NodeTypes.AGGREGATE_NODE:
tmp = true;
break;
case NodeTypes.RESULT_COLUMN:
if (mainKeyWord.equals("UPDATE"))
return true;
break;
case NodeTypes.STATIC_METHOD_CALL_NODE:
tmp = true;
break;
}
if (node instanceof BinaryOperatorNode) {
return true;
}
return tmp;
}
示例2: visit
import com.akiban.sql.parser.QueryTreeNode; //导入依赖的package包/类
/**
* Main visit function, delegates order by columns to sub visit function.
*
* @param node
* @throws StandardException
* @see com.akiban.sql.parser.Visitor#visit(com.akiban.sql.parser.Visitable)
*/
@Override
public Visitable visit(Visitable node) throws StandardException {
switch (((QueryTreeNode) node).getNodeType()) {
case NodeTypes.ORDER_BY_LIST:
break;
case NodeTypes.ORDER_BY_COLUMN:
visit((OrderByColumn) node);
break;
default:
// throw new StandardException("Unbekannter Parameter: \n " +
// node.getClass() + "\n" + node.toString());
}
return node;
}
示例3: skipChildren
import com.akiban.sql.parser.QueryTreeNode; //导入依赖的package包/类
@Override
public boolean skipChildren(Visitable node) throws StandardException {
switch (((QueryTreeNode) node).getNodeType()) {
case NodeTypes.JOIN_NODE:
case NodeTypes.FULL_OUTER_JOIN_NODE:
case NodeTypes.HALF_OUTER_JOIN_NODE:
if (stopChilds == true)
return true;
break;
}
if (node instanceof BinaryOperatorNode)
return true;
return false;
}
示例4: visit
import com.akiban.sql.parser.QueryTreeNode; //导入依赖的package包/类
/**
* Main visit function, delegates entries to the according sub visit
* function.
*
* @param node
* @throws StandardException
* @see com.akiban.sql.parser.Visitor#visit(com.akiban.sql.parser.Visitable)
*/
@Override
public Visitable visit(Visitable node) throws StandardException {
switch (((QueryTreeNode) node).getNodeType()) {
case NodeTypes.GROUP_BY_LIST:
break;
case NodeTypes.GROUP_BY_COLUMN:
visit((GroupByColumn) node);
break;
default:
// throw new StandardException("Unbekannter Parameter: \n " +
// node.getClass() + "\n" + node.toString());
}
return node;
}
示例5: tryRouteForTable
import com.akiban.sql.parser.QueryTreeNode; //导入依赖的package包/类
private static RouteResultset tryRouteForTable(QueryTreeNode ast,
SchemaConfig schema, RouteResultset rrs, boolean isSelect,
String sql, TableConfig tc, Set<ColumnRoutePair> col2Val)
throws SQLNonTransientException {
if (tc.getTableType() == TableConfig.TYPE_GLOBAL_TABLE && isSelect) {
return routeToSingleNode(rrs, tc.getRandomDataNode(), sql);
}
// no partion define or no where condtion for this table or no
// partion column condtions
if (col2Val == null || col2Val.isEmpty()) {
if (tc.isRuleRequired()) {
throw new IllegalArgumentException("route rule for table "
+ tc.getName() + " is required: " + sql);
}
// all datanode of this table should route
return routeToMultiNode(isSelect, ast, rrs, tc.getDataNodes(), sql);
}
// match table with where condtion of partion colum values
Set<String> dataNodeSet = ruleCalculate(tc, col2Val);
return routeToMultiNode(isSelect, ast, rrs, dataNodeSet, sql);
}
示例6: routeToMultiNode
import com.akiban.sql.parser.QueryTreeNode; //导入依赖的package包/类
private static RouteResultset routeToMultiNode(boolean isSelect,
QueryTreeNode ast, RouteResultset rrs,
Collection<String> dataNodes, String stmt)
throws SQLSyntaxErrorException {
if (isSelect) {
String sql = SelectSQLAnalyser.analyseMergeInf(rrs, ast, true);
if (sql != null) {
stmt = sql;
}
}
RouteResultsetNode[] nodes = new RouteResultsetNode[dataNodes.size()];
int i = 0;
for (String dataNode : dataNodes) {
nodes[i++] = new RouteResultsetNode(dataNode, rrs.getSqlType(),
stmt);
}
rrs.setNodes(nodes);
return rrs;
}
示例7: testSQL
import com.akiban.sql.parser.QueryTreeNode; //导入依赖的package包/类
@Test
public void testSQL() throws SQLSyntaxErrorException {
String sql = null;
QueryTreeNode ast = null;
DeleteParsInf parsInf = null;
sql = "delete from A";
ast = SQLParserDelegate.parse(sql, SQLParserDelegate.DEFAULT_CHARSET);
parsInf = DeleteSQLAnalyser.analyse(ast);
Assert.assertEquals("A".toUpperCase(), parsInf.tableName);
Assert.assertNull("should no where condiont", parsInf.ctx);
sql = "delete from A where A.id=10000";
ast = SQLParserDelegate.parse(sql, SQLParserDelegate.DEFAULT_CHARSET);
parsInf = DeleteSQLAnalyser.analyse(ast);
Assert.assertEquals("A".toUpperCase(), parsInf.tableName);
Assert.assertEquals(1, parsInf.ctx.tablesAndCondtions.size());
}
示例8: testSQL
import com.akiban.sql.parser.QueryTreeNode; //导入依赖的package包/类
@Test
public void testSQL() throws SQLSyntaxErrorException {
String sql = null;
QueryTreeNode ast = null;
DDLParsInf parsInf = null;
sql = "CREATE TABLE Persons ( Id_P int,LastName varchar(255),FirstName varchar(255),Address varchar(255),City varchar(255))";
ast = SQLParserDelegate.parse(sql, SQLParserDelegate.DEFAULT_CHARSET);
parsInf = DDLSQLAnalyser.analyse(ast);
Assert.assertEquals("Persons".toUpperCase(), parsInf.tableName);
// sql = "CREATE TABLE \"Persons\" ( \"Id_P\" int,LastName varchar(255),FirstName varchar(255),Address varchar(255),City varchar(255))";
// ast = SQLParserDelegate.parse(sql, SQLParserDelegate.DEFAULT_CHARSET);
// parsInf = DDLSQLAnalyser.analyse(ast);
// Assert.assertEquals("Persons".toUpperCase(), parsInf.tableName);
}
示例9: describeTo
import com.akiban.sql.parser.QueryTreeNode; //导入依赖的package包/类
@Override
public void describeTo(Description description) {
description.appendText("function ").
appendText(functionName);
if (orderedArgumentMatchers.length > 0) {
description.appendText(" called with arguments ");
for (int i = 0; i < orderedArgumentMatchers.length; i++) {
Matcher<QueryTreeNode> submatcher = orderedArgumentMatchers[i];
if (i > 0) {
description.appendText(", ");
}
description.appendDescriptionOf(submatcher);
}
}
}
示例10: describeMismatchSafely
import com.akiban.sql.parser.QueryTreeNode; //导入依赖的package包/类
@Override
protected void describeMismatchSafely(QueryTreeNode item, Description mismatchDescription) {
if (item != null) {
final StringWriter writer = new StringWriter();
item.treePrint(writer);
String sql = null;
try {
sql = new NodeToString().toString(item);
} catch (StandardException e) {
e.printStackTrace();
}
mismatchDescription.appendText("was ")
.appendText(sql)
.appendText(writer.toString());
} else {
super.describeMismatchSafely(null, mismatchDescription);
}
}
示例11: matchesSafely
import com.akiban.sql.parser.QueryTreeNode; //导入依赖的package包/类
@Override
protected boolean matchesSafely(QueryTreeNode item) {
if (item instanceof InListOperatorNode) {
InListOperatorNode node = (InListOperatorNode) item;
ValueNodeList leftList = node.getLeftOperand().getNodeList();
if (leftList.size() == 1 && !(leftMatcher instanceof ListOfNodeMatcher)) {
//unwrap the (non-list) single valued left operand from the left list
if (!leftMatcher.matches(leftList.get(0))) {
return false;
}
} else {
if (!leftMatcher.matches(leftList)) {
return false;
}
}
return rightMatcher.matches(node.getRightOperandList().getNodeList());
}
return false;
}
示例12: matchesSafely
import com.akiban.sql.parser.QueryTreeNode; //导入依赖的package包/类
@Override
protected boolean matchesSafely(QueryTreeNode item) {
final QueryTreeNode checkThisItem;
if (checkSingleCharLiteral && item instanceof SQLToJavaValueNode) {
checkThisItem = ((SQLToJavaValueNode) item).getSQLValueNode();
} else {
checkThisItem = item;
}
if (checkThisItem instanceof ConstantNode) {
Object value = ((ConstantNode) checkThisItem).getValue();
if (matcher == null) {
if (value instanceof Number && literal instanceof Number) {
return ((Number) value).doubleValue() == ((Number) literal).doubleValue();
} else {
return literal.equals(value);
}
} else {
return matcher.matches(value);
}
}
return false;
}
示例13: matchesSafely
import com.akiban.sql.parser.QueryTreeNode; //导入依赖的package包/类
@Override
protected boolean matchesSafely(QueryTreeNode item) {
if (item instanceof TrimOperatorNode) {
TrimOperatorNode node = (TrimOperatorNode) item;
String nodeTrimChar = null;
try {
nodeTrimChar = ((CharConstantNode) node.getRightOperand()).getString();
} catch (StandardException e) {
e.printStackTrace();
}
return trimQualifier.getOperator().equals(node.getOperator())
&& String.valueOf(trimChar).equals(nodeTrimChar)
&& trimSourceMatcher.matches(node.getLeftOperand());
}
return false;
}
示例14: visit
import com.akiban.sql.parser.QueryTreeNode; //导入依赖的package包/类
@Override
public Visitable visit(Visitable node) throws StandardException {
switch (((QueryTreeNode) node).getNodeType()) {
case NodeTypes.JAVA_TO_SQL_VALUE_NODE:
visit((JavaToSQLValueNode) node);
break;
case NodeTypes.RESULT_COLUMN:
break;
case NodeTypes.AGGREGATE_NODE:
visit((AggregateNode) node);
break;
case NodeTypes.COLUMN_REFERENCE:
ColumnStructure tmp = new ColumnStructure(
((ColumnReference) node).getColumnName(), null);
tableName = ((ColumnReference) node).getTableName();
setOperand(tmp);
break;
default:
if (node instanceof BinaryOperatorNode) {
visit((BinaryOperatorNode) node);
} else if (node instanceof ConstantNode) {
visit((ConstantNode) node);
} else if (node instanceof SQLToJavaValueNode) {
} else
throw new StandardException("Unbekannter Parameter: \n "
+ node.getClass() + "\n" + node.toString());
break;
}
return node;
}
示例15: visit
import com.akiban.sql.parser.QueryTreeNode; //导入依赖的package包/类
/**
* Main visit function, delegates entries to the according sub visit
* function.
*
* @param node
* @throws StandardException
* @see com.akiban.sql.parser.Visitor#visit(com.akiban.sql.parser.Visitable)
*/
@Override
public Visitable visit(Visitable node) throws StandardException {
switch (((QueryTreeNode) node).getNodeType()) {
case NodeTypes.FROM_LIST:
break;
case NodeTypes.FROM_BASE_TABLE:
tables.add(new TableStructure(((FromTable) node).getOrigTableName().getTableName()));
break;
case NodeTypes.FULL_OUTER_JOIN_NODE:
case NodeTypes.HALF_OUTER_JOIN_NODE:
case NodeTypes.JOIN_NODE:
visit((JoinNode) node);
break;
default:
if (node instanceof BinaryOperatorNode) {
} else if (node instanceof ConstantNode) {
} else if (node instanceof ColumnReference) {
} else {
throw new StandardException("Unbekannter Parameter: \n "
+ node.getClass() + "\n" + node.toString());
}
break;
}
return node;
}