|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
Class representing JSQL query. JSQL allows to select members of Perst collections
using SQL like predicate. Almost all Perst collections have select() method
which execute arbitrary JSQL query. But it is also possible to create Query instance explicitely,
Using storage.createQuery class. In this case it is possible to specify query with parameters,
once prepare query and then multiple times specify parameters and execute it.
Also Query interface allows to specify indices and resolvers.
JSQL can use arbitrary Perst GenericIndex to perform fast selection if object
instead of sequeial search. And user provided resolver allows to substitute SQL joins.
| Method Summary | |
|---|---|
void |
addIndex(java.lang.String key,
GenericIndex<T> index)
Add index which can be used to optimize query execution (replace sequential search with direct index access) |
void |
enableRuntimeErrorReporting(boolean enabled)
Enable or disable reporting of runtime errors on console. |
java.util.Iterator<T> |
execute(java.util.Iterator<T> iterator)
Execute prepared query |
void |
prepare(java.lang.Class cls,
java.lang.String predicate)
Prepare SQL statement |
void |
prepare(java.lang.String className,
java.lang.String predicate)
Prepare SQL statement |
java.util.Iterator<T> |
select(java.lang.Class cls,
java.util.Iterator<T> iterator,
java.lang.String predicate)
Execute query |
java.util.Iterator<T> |
select(java.lang.String className,
java.util.Iterator<T> iterator,
java.lang.String predicate)
Execute query |
void |
setBoolParameter(int index,
boolean value)
Set value of query parameter |
void |
setIntParameter(int index,
long value)
Set value of query parameter |
void |
setParameter(int index,
java.lang.Object value)
Set value of query parameter |
void |
setRealParameter(int index,
double value)
Set value of query parameter |
void |
setResolver(java.lang.Class original,
java.lang.Class resolved,
Resolver resolver)
Specify resolver. |
| Method Detail |
|---|
void addIndex(java.lang.String key,
GenericIndex<T> index)
key - indexed fieldindex - implementation of indexvoid enableRuntimeErrorReporting(boolean enabled)
enabled - if true then reportnig is enabledjava.util.Iterator<T> execute(java.util.Iterator<T> iterator)
iterator - iterator for sequential access to objects in the table
void prepare(java.lang.Class cls,
java.lang.String predicate)
cls - class of iterated objectspredicate - selection crieria with '?' placeholders for parameter value
void prepare(java.lang.String className,
java.lang.String predicate)
className - name of the class of iterated objectspredicate - selection crieria with '?' placeholders for parameter value
java.util.Iterator<T> select(java.lang.Class cls,
java.util.Iterator<T> iterator,
java.lang.String predicate)
throws CompileError
cls - class of inspected objectsiterator - iterator for sequential access to objects in the tablepredicate - selection crieria
CompileError
java.util.Iterator<T> select(java.lang.String className,
java.util.Iterator<T> iterator,
java.lang.String predicate)
throws CompileError
className - name of the class of inspected objectsiterator - iterator for sequential access to objects in the tablepredicate - selection crieria
CompileError
void setBoolParameter(int index,
boolean value)
index - parameters index (1 based)value - value of boolean parameter
void setIntParameter(int index,
long value)
index - parameters index (1 based)value - value of integer parameter
void setParameter(int index,
java.lang.Object value)
index - parameters index (1 based)value - value of parameter (for scalar parameters instance f correspondendt wrapper class,
for example java.lang.Long
void setRealParameter(int index,
double value)
index - parameters index (1 based)value - value of real parameter
void setResolver(java.lang.Class original,
java.lang.Class resolved,
Resolver resolver)
original - class which instances will have to be resolvedresolved - class of the resolved objectresolver - class implementing Resolver interface
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||