KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > hql > ast > tree > InsertStatement


1 // $Id: InsertStatement.java,v 1.1 2005/07/12 20:27:16 steveebersole Exp $
2
package org.hibernate.hql.ast.tree;
3
4 import org.hibernate.QueryException;
5 import org.hibernate.hql.antlr.HqlSqlTokenTypes;
6
7 /**
8  * Defines a top-level AST node representing an HQL "insert select" statement.
9  *
10  * @author Steve Ebersole
11  */

12 public class InsertStatement extends AbstractStatement {
13
14     /**
15      * @see Statement#getStatementType()
16      */

17     public int getStatementType() {
18         return HqlSqlTokenTypes.INSERT;
19     }
20
21     /**
22      * @see Statement#needsExecutor()
23      */

24     public boolean needsExecutor() {
25         return true;
26     }
27
28     /**
29      * Performs detailed semantic validation on this insert statement tree.
30      *
31      * @throws QueryException Indicates validation failure.
32      */

33     public void validate() throws QueryException {
34         getIntoClause().validateTypes( getSelectClause() );
35     }
36
37     /**
38      * Retreive this insert statement's into-clause.
39      *
40      * @return The into-clause
41      */

42     public IntoClause getIntoClause() {
43         return ( IntoClause ) getFirstChild();
44     }
45
46     /**
47      * Retreive this insert statement's select-clause.
48      *
49      * @return The select-clause.
50      */

51     public SelectClause getSelectClause() {
52         return ( ( QueryNode ) getIntoClause().getNextSibling() ).getSelectClause();
53     }
54
55 }
56
Popular Tags