cds.sql
Class SQLSelectFromWhere

java.lang.Object
  extended bycds.sql.SQLSelectFromWhere

public class SQLSelectFromWhere
extends java.lang.Object

SQL 'SELECT...FROM...WHERE' statement building class.
It receives column names, table names, and conditions.
It is possible to add colums in the SELECT part through different methodss, and several table names in the FROM part in an asynchronous way.

When finished, the toString() method returns the full INSERT statement.

Version:
1.0 June 2003
Author:
Marc Wenger/CDS

Field Summary
private  java.lang.StringBuffer colNames
           
private  java.lang.StringBuffer conditions
           
private  java.lang.StringBuffer tableNames
           
 
Constructor Summary
SQLSelectFromWhere()
          Constructor of an SELECT...FROM...WHERE
SQLSelectFromWhere(java.lang.String cols, java.lang.String tables, java.lang.String cond)
          Constructor of a simple SELECT...FROM...WHERE statement.
 
Method Summary
 void addColumn(java.lang.String col)
          Adds a column name into the INSERT command
 void addCondition(java.lang.String cond)
          Add a condition part
 void addTable(java.lang.String table)
          Adds a table name.
 void reset()
          Resets a SQLInsert object (avoiding a object creation)
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

colNames

private java.lang.StringBuffer colNames

tableNames

private java.lang.StringBuffer tableNames

conditions

private java.lang.StringBuffer conditions
Constructor Detail

SQLSelectFromWhere

public SQLSelectFromWhere()
Constructor of an SELECT...FROM...WHERE


SQLSelectFromWhere

public SQLSelectFromWhere(java.lang.String cols,
                          java.lang.String tables,
                          java.lang.String cond)
Constructor of a simple SELECT...FROM...WHERE statement.

Method Detail

addTable

public void addTable(java.lang.String table)
Adds a table name. A command can have several table names

Parameters:
table - table name for the INSERT command

addColumn

public void addColumn(java.lang.String col)
Adds a column name into the INSERT command

Parameters:
col - column name

addCondition

public void addCondition(java.lang.String cond)
Add a condition part

Parameters:
cond - condition part in a WHERE clause

reset

public void reset()
Resets a SQLInsert object (avoiding a object creation)


toString

public java.lang.String toString()