SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

com.solarmetric.kodo.impl.jdbc.sql
Class SQLStatement

java.lang.Object
  |
  +--com.solarmetric.kodo.impl.jdbc.sql.SQLStatement
Direct Known Subclasses:
NonSelectingSQL, Select

public abstract class SQLStatement
extends Object

Base abstraction of any SQL statement.


Field Summary
(package private)  DBDictionary _dict
           
(package private)  ClassResolver _resolver
           
(package private)  SortedSet _tables
           
 
Constructor Summary
SQLStatement(DBDictionary dict, ClassResolver resolver)
           
SQLStatement(SQLStatement copy, ClassResolver resolver)
           
 
Method Summary
 SQLStatement and(SQLStatement same)
          AND the previous WHERE clause with the given one.
 void clear()
          Clear the WHERE clause and table list so that this statement can be reused.
 void clearTable()
          Clear the tables clause.
 void clearWhere()
          Clear the WHERE clause.
(package private)  String columnName(Column col)
          Returns the name of the column, taking into account the return value of the retainTableInWhere() method.
 ClassResolver getClassResolver()
           
 DBDictionary getDictionary()
          Return the DBDictionary in use.
abstract  SQLBuffer getSQLBuffer()
          Return the SQLBuffer to be used for exeucting the statement;
 String[] getTables()
          Return a list of tables used in this statement
 SQLBuffer getWhere()
          Return the WHERE portion of the SQL statement.
(package private)  int getWhereSize()
           
 boolean isValid()
          Return true if at least one table has been set for this SQL statement.
 SQLStatement not()
          NOT the previous WHERE clause.
 SQLStatement or(SQLStatement same)
          OR the previous WHERE clause with the given one.
(package private)  SQLBuffer popWhere()
           
(package private)  void pushWhere(SQLBuffer buffer)
           
(package private) abstract  boolean retainTableInWhere()
          If true, when columns are mentioned in the WHERE clause, they will be in the form table.column.
 String toString()
           
 SQLStatement where(Column[] col, Object[] value)
          Set the criteria to inclde that the the given columns must equal the given values; this also adds the tables of the given columns to the tables clause of this statement.
 SQLStatement where(Column col, boolean value)
          See where(Column,Object).
 SQLStatement where(Column col, char value)
          See where(Column,Object).
 SQLStatement where(Column col, double value)
          See where(Column,Object).
 SQLStatement where(Column col, float value)
          See where(Column,Object).
 SQLStatement where(Column col, int value)
          See where(Column,Object).
 SQLStatement where(Column col, long value)
          See where(Column,Object).
 SQLStatement where(Column col, Object value)
          Set the criteria to inclde that the the given column must equal the given value; this also adds the table of the given column to the tables clause of this statement.
 SQLStatement where(Column col, short value)
          See where(Column,Object).
 SQLStatement where(SQLBuffer clause)
          Set the given clause to the WHERE part of this statement.
(package private)  SQLStatement whereInternal(String table, Column column, Object value)
           
(package private)  SQLStatement whereInternal(String table, String alias, Column column, Object value)
          Internal filter for all where methods; the given value should already be passed through the DBDictionary unless it is null.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_tables

SortedSet _tables

_dict

final DBDictionary _dict

_resolver

final ClassResolver _resolver
Constructor Detail

SQLStatement

public SQLStatement(DBDictionary dict,
                    ClassResolver resolver)

SQLStatement

public SQLStatement(SQLStatement copy,
                    ClassResolver resolver)
Method Detail

getDictionary

public DBDictionary getDictionary()
Return the DBDictionary in use.

getClassResolver

public ClassResolver getClassResolver()

getTables

public String[] getTables()
Return a list of tables used in this statement

clearTable

public void clearTable()
Clear the tables clause.

where

public SQLStatement where(SQLBuffer clause)
Set the given clause to the WHERE part of this statement.

where

public SQLStatement where(Column col,
                          Object value)
Set the criteria to inclde that the the given column must equal the given value; this also adds the table of the given column to the tables clause of this statement.

where

public SQLStatement where(Column col,
                          boolean value)
See where(Column,Object).

where

public SQLStatement where(Column col,
                          char value)
See where(Column,Object).

where

public SQLStatement where(Column col,
                          double value)
See where(Column,Object).

where

public SQLStatement where(Column col,
                          float value)
See where(Column,Object).

where

public SQLStatement where(Column col,
                          int value)
See where(Column,Object).

where

public SQLStatement where(Column col,
                          long value)
See where(Column,Object).

where

public SQLStatement where(Column col,
                          short value)
See where(Column,Object).

where

public SQLStatement where(Column[] col,
                          Object[] value)
Set the criteria to inclde that the the given columns must equal the given values; this also adds the tables of the given columns to the tables clause of this statement.

columnName

String columnName(Column col)
Returns the name of the column, taking into account the return value of the retainTableInWhere() method.

whereInternal

SQLStatement whereInternal(String table,
                           String alias,
                           Column column,
                           Object value)
Internal filter for all where methods; the given value should already be passed through the DBDictionary unless it is null.

whereInternal

SQLStatement whereInternal(String table,
                           Column column,
                           Object value)

getWhere

public SQLBuffer getWhere()
Return the WHERE portion of the SQL statement.

clearWhere

public void clearWhere()
Clear the WHERE clause.

and

public SQLStatement and(SQLStatement same)
AND the previous WHERE clause with the given one. Example: sql.where (foo).and (sql.where (bar));.

or

public SQLStatement or(SQLStatement same)
OR the previous WHERE clause with the given one. Example: sql.where (foo).or (sql.where (bar));.

not

public SQLStatement not()
NOT the previous WHERE clause. Example: sql.where (foo).not ();.

toString

public final String toString()
Overrides:
toString in class Object

isValid

public boolean isValid()
Return true if at least one table has been set for this SQL statement.

clear

public void clear()
Clear the WHERE clause and table list so that this statement can be reused.

popWhere

SQLBuffer popWhere()

pushWhere

void pushWhere(SQLBuffer buffer)

getWhereSize

int getWhereSize()

retainTableInWhere

abstract boolean retainTableInWhere()
If true, when columns are mentioned in the WHERE clause, they will be in the form table.column.

getSQLBuffer

public abstract SQLBuffer getSQLBuffer()
Return the SQLBuffer to be used for exeucting the statement;

SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.