|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.acmsl.queryj.Query
|
+--org.acmsl.queryj.SelectQuery
Represents standard SQL select queries.
| Field Summary |
| Fields inherited from interface java.sql.Statement |
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO |
| Constructor Summary | |
SelectQuery()
Constructs a query. |
|
| Method Summary | |
protected void |
addField(Field field)
Adds a new field. |
protected void |
addGroupingField(Field groupingField)
Adds a new grouping field. |
protected void |
addOrderingField(Field orderingField)
Adds a new ordering field. |
boolean |
execute(java.lang.String sql,
Field[] fields)
Executes given update operation using field references. |
java.sql.ResultSet |
executeQuery()
See java.sql.PreparedStatement#executeQuery(). |
int |
executeUpdate(java.lang.String sql,
Field[] fields)
Executes given update operation using field references. |
void |
from(Table table)
Indicates which table participates in the query. |
protected int |
getFieldIndex(Field field)
Retrieves the position of given field on the query. |
protected java.util.List |
getFields()
Retrieves the field collection. |
java.sql.ResultSet |
getGeneratedKeys()
See Statement#getGeneratedKeys() |
protected int |
getGroupingFieldIndex(Field field)
Retrieves the position of given grouping field on the query. |
protected java.util.List |
getGroupingFields()
Retrieves the grouping field collection. |
protected int |
getOrderingFieldIndex(Field field)
Retrieves the position of given ordering field on the query. |
protected java.util.List |
getOrderingFields()
Retrieves the ordering field collection. |
void |
groupBy(Field groupingField)
Indicates a field to be used to group the results. |
void |
orderBy(Field orderingField)
Indicates a field to be used to order the results. |
QueryResultSet |
retrieveMatchingResults()
Looks for the records that match the filter. |
void |
select(Field field)
Selects a field. |
protected void |
setFields(java.util.List list)
Specifies new field collection. |
protected void |
setGroupingFields(java.util.List list)
Specifies new grouping field collection. |
protected void |
setOrderingFields(java.util.List list)
Specifies new ordering field collection. |
java.lang.String |
toString()
Outputs a text version of the query, in SQL format. |
void |
where(Condition condition)
Indicates a query condition. |
void |
where(VariableCondition variableCondition)
Indicates a query variable condition. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public SelectQuery()
| Method Detail |
protected void setFields(java.util.List list)
list - the new list.protected java.util.List getFields()
protected void addField(Field field)
field - the field to add.protected int getFieldIndex(Field field)
field - the field to find.
protected void setOrderingFields(java.util.List list)
list - the new list.protected java.util.List getOrderingFields()
protected void addOrderingField(Field orderingField)
orderingField - the ordering field to add.protected int getOrderingFieldIndex(Field field)
field - the field to find.
protected void setGroupingFields(java.util.List list)
list - the new list.protected java.util.List getGroupingFields()
protected void addGroupingField(Field groupingField)
groupingField - the grouping field to add.protected int getGroupingFieldIndex(Field field)
field - the field to find.
public void select(Field field)
field - the field to select.public void from(Table table)
table - the table.public void where(Condition condition)
condition - such condition.public void where(VariableCondition variableCondition)
variableCondition - such variable condition.public void groupBy(Field groupingField)
groupingField - such field.public void orderBy(Field orderingField)
orderingField - such field.
public QueryResultSet retrieveMatchingResults()
throws java.sql.SQLException
retrieveMatchingResults in class Queryjava.sql.SQLException - if an error occurs.
public java.sql.ResultSet executeQuery()
throws java.sql.SQLException
executeQuery in interface java.sql.PreparedStatementexecuteQuery in class Queryjava.sql.SQLException - if an error occurs.PreparedStatement.executeQuery()
public java.sql.ResultSet getGeneratedKeys()
throws java.sql.SQLException
getGeneratedKeys in interface java.sql.StatementgetGeneratedKeys in class Queryjava.sql.SQLException - if an error occurs.Statement.getGeneratedKeys()
public int executeUpdate(java.lang.String sql,
Field[] fields)
throws java.sql.SQLException
sql - (Taken from Sun's Javadoc) must be an SQL INSERT, UPDATE
or DELETE statement or an SQL statement that returns nothing.fields - the fields.
java.sql.SQLException - if an error occurs.
public boolean execute(java.lang.String sql,
Field[] fields)
throws java.sql.SQLException
sql - (Taken from Sun's Javadoc) must be an SQL INSERT, UPDATE
or DELETE statement or an SQL statement that returns nothing.fields - the fields.
java.sql.SQLException - if an error occurs.public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||