|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.fluxion.datapublisher.sql.impl.SQLQuery<T>
public abstract class SQLQuery<T>
Models a query against a MySQL bean. Queries are typed with the type of bean
the query acts against. A SQLQuery
would usually be generated from a
SQLQueryFactory
.
SQLQueryFactory
Field Summary | |
---|---|
protected java.sql.Connection |
connection
|
protected java.lang.String |
dbUri
|
protected java.lang.String |
password
|
protected java.lang.String |
user
|
Constructor Summary | |
---|---|
SQLQuery(java.lang.Class<T> beanClass,
Filter filter,
java.lang.String dbUrl,
java.lang.String user,
java.lang.String password)
|
Method Summary | |
---|---|
void |
addFromClause(java.lang.String table)
Adds the "from" clause for this query |
void |
addSelectClause(java.lang.String selection)
Adds the "select" clause for this query |
void |
addWhereClause(java.lang.String param)
Adds the "where" clause for this query |
protected abstract void |
closeConnection()
Close the connection to the datasource. |
java.lang.String |
execute()
Execute this query. |
boolean |
hasMoreResults()
True if there are more results, false otherwise |
T |
nextResult()
Returns the next result in the sequence |
protected abstract void |
openConnection()
Acquire a connection to the underlying datasource. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String dbUri
protected java.lang.String user
protected java.lang.String password
protected java.sql.Connection connection
Constructor Detail |
---|
public SQLQuery(java.lang.Class<T> beanClass, Filter filter, java.lang.String dbUrl, java.lang.String user, java.lang.String password)
Method Detail |
---|
public java.lang.String execute() throws QueryExecutionException
Query
execute
in interface Query<T>
QueryExecutionException
- if the query failed to executepublic boolean hasMoreResults() throws QueryExecutionException
Query
hasMoreResults
in interface Query<T>
QueryExecutionException
- if there is some problem with retrieving
the results of the querypublic T nextResult() throws QueryExecutionException
Query
nextResult
in interface Query<T>
QueryExecutionException
- if there is a problem retrieving the next
resultpublic void addSelectClause(java.lang.String selection)
selection
- the fields being selectedpublic void addFromClause(java.lang.String table)
table
- the table being queriedpublic void addWhereClause(java.lang.String param)
param
- the parameters for this queryprotected abstract void openConnection() throws QueryExecutionException
execute()
to first acquire a new connection to satisfy the
query.
QueryExecutionException
- if the connection couldn't be openedprotected abstract void closeConnection() throws QueryExecutionException
execute()
once the query is completed.
QueryExecutionException
- if the connection failed to close properly
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |