ca.spaz.sql
Class SQLSelect

java.lang.Object
  extended by ca.spaz.sql.SQLStatement
      extended by ca.spaz.sql.SQLSelectableStatement
          extended by ca.spaz.sql.SQLSelect

public class SQLSelect
extends SQLSelectableStatement

Conveniently produces simple SQL SELECT statements Currently only handles basic column selection and where based on column equality.

Author:
Aaron Davidson

Field Summary
protected  java.util.List items
           
protected  java.sql.ResultSet results
           
 
Fields inherited from class ca.spaz.sql.SQLSelectableStatement
EQ, GT, LT
 
Fields inherited from class ca.spaz.sql.SQLStatement
table
 
Constructor Summary
SQLSelect(SQLSelect subSelection)
           
SQLSelect(java.lang.String tableName)
          Create a new SQLUpdate command for the given table
SQLSelect(java.lang.String[] joinedTables)
           
 
Method Summary
 void addOrderBy(java.lang.String orderClause)
           
 void addSelection(java.lang.String field)
          Add an item to select
 void addSelection(java.lang.String field, java.lang.String as)
           
protected  java.sql.ResultSet doExecuteQuery(java.sql.Connection con)
          Execute the query and return the results.
protected  java.lang.String getQueryString()
          Generate the SQL string for a SELECT command.
 
Methods inherited from class ca.spaz.sql.SQLSelectableStatement
addWhere, addWhere, addWhere, addWhere, addWhere, addWhere, addWhere, addWhere, addWhereLike, getWhere
 
Methods inherited from class ca.spaz.sql.SQLStatement
doExecute, execute, executeQuery, getTableName, isExecuteSupported, isQuerySupported, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

items

protected java.util.List items

results

protected java.sql.ResultSet results
Constructor Detail

SQLSelect

public SQLSelect(java.lang.String tableName)
Create a new SQLUpdate command for the given table

Parameters:
tableName - the name of the table to update on

SQLSelect

public SQLSelect(SQLSelect subSelection)

SQLSelect

public SQLSelect(java.lang.String[] joinedTables)
Method Detail

addOrderBy

public void addOrderBy(java.lang.String orderClause)

addSelection

public void addSelection(java.lang.String field)
Add an item to select

Parameters:
field - a valid SQL selection item

addSelection

public void addSelection(java.lang.String field,
                         java.lang.String as)

doExecuteQuery

protected java.sql.ResultSet doExecuteQuery(java.sql.Connection con)
                                     throws java.sql.SQLException
Execute the query and return the results.

Overrides:
doExecuteQuery in class SQLStatement
Throws:
java.sql.SQLException

getQueryString

protected java.lang.String getQueryString()
Generate the SQL string for a SELECT command.

Specified by:
getQueryString in class SQLStatement


Copyright © 2005 Spaz. All Rights Reserved.