001package gudusoft.gsqlparser.nodes;
002
003
004import gudusoft.gsqlparser.ESqlClause;
005import gudusoft.gsqlparser.TCustomSqlStatement;
006
007/**
008 * SQL Server value() Method performs an XQuery against the XML and returns a value of SQL type.
009 * <p></p>
010 * You typically use this method to extract a value from an XML instance stored in an xml type
011 * column, parameter, or variable.
012 * <p></p>
013 * This class represents an xml type column, parameter, variable or subquery.
014 *
015 * <pre>
016 *     DECLARE @myDoc xml
017 *      DECLARE @ProdID int
018 *      SET @myDoc = '&lt;Root&gt;
019 *     &lt;ProductDescription ProductID="1" ProductName="Road Bike"&gt;
020 *     &lt;Features&gt;
021 *     &lt;Warranty&gt;1 year parts and labor&lt;/Warranty&gt;
022 *     &lt;Maintenance&gt;3 year parts and labor extended maintenance is available&lt;/Maintenance&gt;
023 *     &lt;/Features&gt;
024 *     &lt;/ProductDescription&gt;
025 *     &lt;/Root&gt;'
026 *     SET @ProdID =  @myDoc.value('(/Root/ProductDescription/@ProductID)[1]', 'int' )
027 *     SELECT @ProdID
028 * </pre>
029 *
030 * In the above SQL, this class represents &lt;code &gt; @myDoc&lt;/code&gt; before the value() function.
031 *
032 */
033public class TExpressionCallTarget extends TParseTreeNode {
034
035    private TExpression expr;
036
037    public void setExpr(TExpression expr) {
038        this.expr = expr;
039    }
040
041    public TExpression getExpr() {
042
043        return expr;
044    }
045
046    public void doParse(TCustomSqlStatement psql, ESqlClause plocation){
047//        switch (expr.getExpressionType()){
048//            case subquery_t:
049//                break;
050//        }
051        expr.doParse(psql,plocation);
052
053    }
054
055    public void accept(TParseTreeVisitor v){
056        v.preVisit(this);
057        v.postVisit(this);
058    }
059    public void acceptChildren(TParseTreeVisitor v){
060        v.preVisit(this);
061        expr.acceptChildren(v);
062        v.postVisit(this);
063    }
064
065    public void init(Object arg1){
066        expr = (TExpression)arg1;
067    }
068
069
070}