/** * Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed * to work. * * @param depth The depth of this node in the tree */ public void printSubNodes(int depth) { if (SanityManager.DEBUG) { super.printSubNodes(depth); if (subquery != null) { printLabel(depth, "subquery: "); subquery.treePrint(depth + 1); } if (orderByList != null) { printLabel(depth, "orderByList: "); orderByList.treePrint(depth + 1); } if (offset != null) { printLabel(depth, "offset: "); offset.treePrint(depth + 1); } if (fetchFirst != null) { printLabel(depth, "fetchFirst: "); fetchFirst.treePrint(depth + 1); } } }
/** * Accept the visitor for all visitable children of this node. * * @param v the visitor * @exception StandardException on error */ void acceptChildren(Visitor v) throws StandardException { super.acceptChildren(v); if (methodCall != null) { methodCall = (MethodCallNode) methodCall.accept(v); } }
/** * Extract out and return the subquery, with a PRN on top. (See FromSubquery.preprocess() for more * details.) * * @param numTables The number of tables in the DML Statement * @return ResultSetNode at top of extracted tree. * @exception StandardException Thrown on error */ public ResultSetNode extractSubquery(int numTables) throws StandardException { JBitSet newJBS; ResultSetNode newPRN; newPRN = (ResultSetNode) getNodeFactory() .getNode( C_NodeTypes.PROJECT_RESTRICT_NODE, subquery, /* Child ResultSet */ resultColumns, /* Projection */ null, /* Restriction */ null, /* Restriction as PredicateList */ null, /* Subquerys in Projection */ null, /* Subquerys in Restriction */ tableProperties, getContextManager()); /* Set up the PRN's referencedTableMap */ newJBS = new JBitSet(numTables); newJBS.set(tableNumber); newPRN.setReferencedTableMap(newJBS); ((FromTable) newPRN).setTableNumber(tableNumber); return newPRN; }
/** Fill this node with a deep copy of the given node. */ public void copyFrom(QueryTreeNode node) throws StandardException { super.copyFrom(node); FromVTI other = (FromVTI) node; this.methodCall = (MethodCallNode) getNodeFactory().copyNode(other.methodCall, getParserContext()); this.exposedName = (TableName) getNodeFactory().copyNode(other.exposedName, getParserContext()); this.subqueryList = (SubqueryList) getNodeFactory().copyNode(other.subqueryList, getParserContext()); this.isTarget = other.isTarget; }
/** @see QueryTreeNode#acceptChildren */ void acceptChildren(Visitor v) throws StandardException { super.acceptChildren(v); subquery.accept(v); if (orderByList != null) { orderByList.accept(v); } if (offset != null) { offset.accept(v); } if (fetchFirst != null) { fetchFirst.accept(v); } }
/** * Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed * to work. * * @param depth The depth of this node in the tree */ public void printSubNodes(int depth) { super.printSubNodes(depth); if (methodCall != null) { printLabel(depth, "methodCall: "); methodCall.treePrint(depth + 1); } if (exposedName != null) { printLabel(depth, "exposedName: "); exposedName.treePrint(depth + 1); } if (subqueryList != null) { printLabel(depth, "subqueryList: "); subqueryList.treePrint(depth + 1); } }
/** * Intializer for a table in a FROM list. * * @param subquery The subquery * @param orderByList ORDER BY list if any, or null * @param offset OFFSET if any, or null * @param fetchFirst FETCH FIRST if any, or null * @param hasJDBClimitClause True if the offset/fetchFirst clauses come from JDBC limit/offset * escape syntax * @param correlationName The correlation name * @param derivedRCL The derived column list * @param tableProperties Properties list associated with the table */ public void init( Object subquery, Object orderByList, Object offset, Object fetchFirst, Object hasJDBClimitClause, Object correlationName, Object derivedRCL, Object tableProperties) { super.init(correlationName, tableProperties); this.subquery = (ResultSetNode) subquery; this.orderByList = (OrderByList) orderByList; this.offset = (ValueNode) offset; this.fetchFirst = (ValueNode) fetchFirst; this.hasJDBClimitClause = (hasJDBClimitClause == null) ? false : ((Boolean) hasJDBClimitClause).booleanValue(); resultColumns = (ResultColumnList) derivedRCL; }
/** * @param invocation The constructor or static method for the VTI * @param correlationName The correlation name * @param derivedRCL The derived column list * @param tableProperties Properties list associated with the table * @param exposedTableName The table name (TableName class) * @exception StandardException Thrown on error */ public void init( Object invocation, Object correlationName, Object derivedRCL, Object tableProperties, Object exposedTableName) throws StandardException { super.init(correlationName, tableProperties); this.methodCall = (MethodCallNode) invocation; resultColumns = (ResultColumnList) derivedRCL; subqueryList = (SubqueryList) getNodeFactory().getNode(NodeTypes.SUBQUERY_LIST, getParserContext()); /* Cache exposed name for this table. * The exposed name becomes the qualifier for each column * in the expanded list. */ this.exposedName = (TableName) exposedTableName; }
/** * Decrement (query block) level (0-based) for this FromTable. This is useful when flattening a * subquery. * * @param decrement The amount to decrement by. */ void decrementLevel(int decrement) { super.decrementLevel(decrement); subquery.decrementLevel(decrement); }