ca.spaz.sql
Class SQLSelect
java.lang.Object
ca.spaz.sql.SQLStatement
ca.spaz.sql.SQLSelectableStatement
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
|
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
items
protected java.util.List items
results
protected java.sql.ResultSet results
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)
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.