org.gibello.zql
Class ZInsert

java.lang.Object
  extended by org.gibello.zql.ZInsert
All Implemented Interfaces:
java.io.Serializable, ZStatement

public class ZInsert
extends java.lang.Object
implements ZStatement

ZInsert: an SQL INSERT statement

See Also:
Serialized Form

Constructor Summary
ZInsert(java.lang.String tab)
          Create an INSERT statement on a given table
 
Method Summary
 void addColumns(java.util.Vector c)
          Specify which columns to insert
 void addValueSpec(ZExp e)
          Specify the VALUES part or SQL sub-query of the INSERT statement
 java.util.Vector getColumns()
          Get the columns involved in the INSERT statement.
 ZQuery getQuery()
          Get the sub-query (ex. in INSERT INTO table1 SELECT * FROM table2;, the sub-query is SELECT * FROM table2;)
 java.lang.String getTable()
          Get the name of the table involved in the INSERT statement.
 java.util.Vector getValues()
          Get the VALUES part of the INSERT statement
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ZInsert

public ZInsert(java.lang.String tab)
Create an INSERT statement on a given table

Method Detail

getTable

public java.lang.String getTable()
Get the name of the table involved in the INSERT statement.

Returns:
A String equal to the table name

getColumns

public java.util.Vector getColumns()
Get the columns involved in the INSERT statement.

Returns:
A Vector of Strings equal to the column names

addColumns

public void addColumns(java.util.Vector c)
Specify which columns to insert

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

addValueSpec

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

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

getValues

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

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

getQuery

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

Returns:
A ZQuery 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()
Overrides:
toString in class java.lang.Object