butler.sql.query
Class QueryInstance
java.lang.Object
butler.sql.query.QueryInstance
- All Implemented Interfaces:
- Populatable
- Direct Known Subclasses:
- DeleteQuery.DeleteQueryInstance
public class QueryInstance
- extends java.lang.Object
- implements Populatable
A instance of a query. A query represents a SQL statement without
parameters and a query instance represents a SQL statement plus
parameters.
- Author:
- Fredrik Bertilsson
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_query
protected Query _query
QueryInstance
public QueryInstance(Query query)
QueryInstance
public QueryInstance()
QueryInstance
public QueryInstance(java.lang.String xml)
throws java.lang.Exception
- Constructs a QueryInstance from the xml representation.
- Throws:
java.lang.Exception
setQueryParams
public void setQueryParams(QueryParams params)
setParameter
public void setParameter(Filter filter,
java.util.List params)
throws java.lang.Exception
- Sets a number of parameters for the given filter.
- Specified by:
setParameter
in interface Populatable
- Throws:
java.lang.Exception
setParameter
public void setParameter(Filter filter,
java.lang.Object param)
throws java.lang.Exception
- Throws:
java.lang.Exception
addParameter
public void addParameter(java.lang.Object param)
run
public RecordList run()
throws java.lang.Exception
- Executes the SQL statement and returns the result as a
RecordList.
- Throws:
java.lang.Exception
run0
public RecordList run0()
throws java.lang.Exception
- Throws:
java.lang.Exception
getParamList
public java.util.List getParamList()
throws java.lang.Exception
- Throws:
java.lang.Exception
getParamList
public java.util.List getParamList(Filter filter)
throws java.lang.Exception
- Throws:
java.lang.Exception
getQueryParams
public QueryParams getQueryParams()
close
protected void close(JPreparedStatement stmt)
prepareStatement
protected JPreparedStatement prepareStatement(java.sql.Connection conn,
java.lang.String sql)
throws java.lang.Exception
- Throws:
java.lang.Exception
getQuery
public Query getQuery()
toXML
public java.lang.String toXML()
throws java.lang.Exception
- Throws:
java.lang.Exception
toXML
public void toXML(org.xml.sax.ContentHandler handler)
throws java.lang.Exception
- Throws:
java.lang.Exception
parse
public static QueryInstance parse(java.lang.String xml)
throws java.lang.Exception
- Throws:
java.lang.Exception
parseQueryInstance
public static QueryInstance parseQueryInstance(org.dom4j.Element element)
throws java.lang.Exception
- Throws:
java.lang.Exception