org.edg.info.sqlutil.parsql
Class InsertStatement

java.lang.Object
  extended byorg.edg.info.sqlutil.parsql.InsertStatement
All Implemented Interfaces:
java.io.Serializable, Statement

public class InsertStatement
extends java.lang.Object
implements Statement

InsertStatement: an SQL INSERT statement.

See Also:
Serialized Form

Constructor Summary
InsertStatement(java.lang.String tableName)
          Create an INSERT statement on a given table
 
Method Summary
 void addColumns(java.util.Vector columns)
          Specifies column names.
 void addValueSpec(ExpSelConst valueSpec)
          Specify the VALUES part or SQL sub-query of the INSERT statement
 java.util.Vector getColumns()
          Returns vector of columns if specified in the SQL.
 SelectStatement getQuery()
          Get the sub-query (ex.
 java.lang.String getTableName()
           
 java.util.Vector getValues()
          Get the VALUES part of the INSERT statement.
 ExpSelConst getValueSpec()
          Returns the valueSpec for this INSERT statement.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InsertStatement

public InsertStatement(java.lang.String tableName)
Create an INSERT statement on a given table

Method Detail

getTableName

public java.lang.String getTableName()

addColumns

public void addColumns(java.util.Vector columns)
Specifies column names.

Parameters:
columns - A vector of column names (Strings)

getColumns

public java.util.Vector getColumns()
Returns vector of columns if specified in the SQL. If no vector was specified the return value is null.

Returns:
vector of String objects.

addValueSpec

public void addValueSpec(ExpSelConst valueSpec)
Specify the VALUES part or SQL sub-query of the INSERT statement

Parameters:
valueSpec - An SQL expression or a SELECT statement. If it is a list of SQL expressions, valueSpec should be represented by ONE SQL expression with operator = "," and operands = the expressions in the list. If it is a SELECT statement, valueSpec should be a SelectStatement object.

getValueSpec

public ExpSelConst getValueSpec()
Returns the valueSpec for this INSERT statement.


getValues

public java.util.Vector getValues()
Get the VALUES part of the INSERT statement.

Returns:
A vector of SQL Expressions (ExpSelConst objects); If there is no VALUES element but a subquery, returns null (use getQuery() method).

getQuery

public SelectStatement getQuery()
Get the sub-query (ex. "INSERT INTO table1 SELECT * FROM table2;", the sub-query is "SELECT * FROM table2;")

Returns:
A SelectStatement object (A SELECT statement), or null if there's no sub-query (in that case, use the getValues() method to get the VALUES part).

toString

public java.lang.String toString()