T
- the type of DBObject returned by this querypublic final class DBQuery<T extends DBObject>
extends java.lang.Object
Constructor and Description |
---|
DBQuery(DBClassConcrete dbClassConcrete,
DataSource ds)
Creates new Query
|
DBQuery(GlobalId classId,
DataSource ds)
Creates new Query
|
DBQuery(java.lang.String className,
DataSource ds)
Creates new Query
|
Modifier and Type | Method and Description |
---|---|
DBClause |
addClause(DBClause clause)
Add a clause to this query
|
DBClause |
addClause(DBField field,
java.lang.String symbol)
Add a clause to this query
|
DBClause |
addClause(DBField field,
java.lang.String symbol,
java.lang.Object value)
Add a clause to this query
|
DBClause |
addClause(Path path,
java.lang.String symbol)
Add a clause to this query
|
DBClause |
addClause(Path path,
java.lang.String symbol,
java.lang.Object value)
Add a clause to this query
|
DBClause |
addClause(java.lang.String clauses)
Parse the passed clauses.
|
DBClause |
addClause(java.lang.String fieldPath,
java.lang.String symbol)
Deprecated.
use addNull() or addNotNull()
|
DBClause |
addClause(java.lang.String fieldPath,
java.lang.String symbol,
boolean value)
Deprecated.
use addFalse( String field) or addTrue( String field)
|
DBClause |
addClause(java.lang.String fieldPath,
java.lang.String symbol,
GlobalKey value)
Add a clause to this query
|
DBClause |
addClause(java.lang.String fieldPath,
java.lang.String symbol,
java.lang.Object value)
Add a clause to this query
|
DBQuery<T> |
addEquals(DBField field,
java.lang.Object value)
Add a clause to this query
|
DBQuery<T> |
addEquals(java.lang.String fieldPath,
java.lang.Object value)
Add a clause to this query
|
DBQuery<T> |
addFalse(DBField field)
Add a clause to this query
|
DBQuery<T> |
addFalse(java.lang.String fieldPath)
Add a boolean field true clause
|
DBQuery<T> |
addIS(DBField field,
DBObject obj)
Add a clause to this query
|
DBQuery<T> |
addIS(DBField field,
GlobalKey gk)
Add a clause to this query
|
DBQuery<T> |
addIS(java.lang.String fieldPath,
DBObject obj)
Add a clause to this query
|
DBQuery<T> |
addIS(java.lang.String fieldPath,
GlobalKey key)
Add a clause to this query
|
DBQuery<T> |
addLike(DBField field,
java.lang.String value)
Add a clause to this query
|
DBQuery<T> |
addLike(java.lang.String fieldPath,
java.lang.String value)
Add a clause to this query
|
DBQuery<T> |
addMatches(DBField field,
java.lang.String value)
Add a match clause to this query
|
DBQuery<T> |
addMatches(java.lang.String fieldPath,
java.lang.String value)
Add a match clause to this query
|
DBQuery<T> |
addNotEqual(DBField field,
java.lang.Object value)
Add a "NOT EQUAL" clause to this query
|
DBQuery<T> |
addNotEqual(java.lang.String fieldPath,
java.lang.Object value)
Add a "NOT EQUAL" clause to this query
|
DBQuery<T> |
addNotLike(java.lang.String fieldPath,
java.lang.String value)
Add a "NOT LIKE" clause to this query
|
DBQuery<T> |
addNotNull(java.lang.String fieldPath)
Add a NOT null clause to this query
|
DBQuery<T> |
addNull(java.lang.String fieldPath)
Add a NULL clause to this query
|
DBQuery<T> |
addTrue(DBField field)
Add a clause to this query
|
DBQuery<T> |
addTrue(java.lang.String fieldPath)
Add a boolean field true clause
|
java.lang.String |
cacheKey() |
void |
call(DALQueryCallBack callBack)
the called back
|
T |
findOne()
Performs a search as normal, but checks that only one row is found
and returns the found object
|
DBCriteria |
getCriteria()
The list of clauses for this query
|
DBClass |
getDBClass()
Returns the base class for this query.
|
DBClassConcrete |
getDBClassConcrete()
Returns the base class for this query.
|
DataSource |
getDS()
Returns the data source for this query
|
long |
getTimeout()
get the maximum timeout
|
DBResultGroupBySet |
groupBy(Path[] paths,
java.lang.String havingClause)
Group the results from the query by the specified field paths.
|
boolean |
includeDirtyRows()
Should we include the dirty rows ?
|
SearchPlan |
makeSearchPlan()
Make Search plan for the query
|
DBQuery |
orderBy(java.lang.String fields) |
DBResult<T> |
search()
Performs a database search and returns a record set.
|
DBQuery |
setDisableDirtyRows(boolean yes)
Should we include the dirty rows ?
|
DBQuery |
setSearchPlan(SearchPlan plan)
specify a search plan to be used.
|
DBQuery |
setTmeout(long numberOfMilliseconds)
set the maximum run time for this query
|
DBQuery |
setUseCache(boolean yes)
Allows the use of cache to be turned off
|
DBQuery |
setUseIndexInQuery(boolean useIndex)
Allows the use of indexes to be turned off
|
DBQuery |
setUseLinkageCache(boolean yes)
Allows the use of the inward linkage cache to be turned off
|
java.util.stream.Stream<T> |
stream() |
java.lang.String |
toString()
A description of this query
|
boolean |
useCache()
Should we use the internal cache for this query.
|
boolean |
useIndexInQuery()
Should we use indexes for this query ?
|
boolean |
useLinkageCache()
Can we use inward linkage cache ?
|
DBQuery<T> |
where(java.lang.String whereClauses) |
public DBQuery(@Nonnull DBClassConcrete dbClassConcrete, @Nonnull DataSource ds)
dbClassConcrete
- The base classds
- The data source to use.public DBQuery(@Nonnull java.lang.String className, @Nonnull DataSource ds) throws NotFoundException
className
- The base classds
- The data source to use.NotFoundException
- If the class name is not found.public DBQuery(@Nonnull GlobalId classId, @Nonnull DataSource ds) throws java.lang.Exception
classId
- The base class idds
- The data source to usejava.lang.Exception
- If the base class can't be found.@Nonnull public DBQuery<T> where(@Nonnull java.lang.String whereClauses)
whereClauses
- the clauses.@CheckReturnValue @Nonnull public java.lang.String cacheKey()
@CheckReturnValue @Nonnull public java.lang.String toString()
toString
in class java.lang.Object
@CheckReturnValue @Nonnull public DBClass getDBClass()
@CheckReturnValue @Nonnull public DBClassConcrete getDBClassConcrete()
@CheckReturnValue @Nullable public DBCriteria getCriteria()
@Nonnull public DBClause addClause(@Nonnull java.lang.String clauses) throws java.lang.Exception
clauses
- The text format of the clauses.java.lang.Exception
- a serious problem@Nonnull public DBQuery<T> addIS(@Nonnull java.lang.String fieldPath, @Nonnull DBObject obj) throws InvalidClauseException
fieldPath
- The field path for this queryobj
- the objectInvalidClauseException
- The clause is not valid@Nonnull public DBQuery<T> addIS(@Nonnull DBField field, @Nonnull DBObject obj) throws InvalidClauseException
field
- The field path for this queryobj
- the objectInvalidClauseException
- The clause is not valid@Nonnull public DBQuery<T> addIS(@Nonnull DBField field, @Nonnull GlobalKey gk) throws InvalidClauseException
field
- The field path for this querygk
- the objectInvalidClauseException
- The clause is not valid@Nonnull public DBQuery<T> addTrue(@Nonnull java.lang.String fieldPath) throws InvalidClauseException, InvalidPathException
fieldPath
- The field path for this queryInvalidClauseException
- The clause is not validInvalidPathException
- the path is not valid.@Nonnull public DBQuery<T> addTrue(@Nonnull DBField field) throws InvalidClauseException
field
- The field path for this queryInvalidClauseException
- The clause is not valid@Nonnull public DBQuery<T> addFalse(@Nonnull java.lang.String fieldPath) throws InvalidClauseException, InvalidPathException
fieldPath
- The field path for this queryInvalidClauseException
- The clause is not validInvalidPathException
- the path is not valid.@Nonnull public DBQuery<T> addFalse(@Nonnull DBField field) throws InvalidClauseException
field
- The field path for this queryInvalidClauseException
- The clause is not valid@Nonnull public DBQuery<T> addNull(@Nonnull java.lang.String fieldPath) throws InvalidClauseException
fieldPath
- The field path for this queryInvalidClauseException
- The clause is not valid@Nonnull public DBQuery<T> addNotNull(@Nonnull java.lang.String fieldPath) throws InvalidClauseException
fieldPath
- The field path for this queryInvalidClauseException
- The clause is not valid@Nonnull public DBQuery<T> addNotEqual(@Nonnull java.lang.String fieldPath, @Nonnull java.lang.Object value) throws InvalidClauseException
fieldPath
- The field path for this queryvalue
- the value to matchInvalidClauseException
- The clause is not valid@Nonnull public DBQuery<T> addNotLike(@Nonnull java.lang.String fieldPath, @Nonnull java.lang.String value) throws InvalidClauseException
fieldPath
- The field path for this queryvalue
- the value to matchInvalidClauseException
- The clause is not valid@Nonnull public DBQuery<T> addNotEqual(@Nonnull DBField field, @Nonnull java.lang.Object value) throws InvalidClauseException
field
- The field path for this queryvalue
- the value to matchInvalidClauseException
- The clause is not valid@Nonnull public DBQuery<T> addEquals(@Nonnull java.lang.String fieldPath, @Nonnull java.lang.Object value) throws InvalidClauseException
fieldPath
- The field path for this queryvalue
- the value to matchInvalidClauseException
- The clause is not valid@Nonnull public DBQuery<T> addEquals(@Nonnull DBField field, @Nonnull java.lang.Object value) throws InvalidClauseException
field
- The field for this queryvalue
- the value to matchInvalidClauseException
- The clause is not valid@Nonnull public DBQuery<T> addLike(@Nonnull java.lang.String fieldPath, @Nonnull java.lang.String value) throws InvalidClauseException
fieldPath
- The field path for this queryvalue
- the value to matchInvalidClauseException
- The clause is not valid@Nonnull public DBQuery<T> addLike(@Nonnull DBField field, @Nonnull java.lang.String value) throws InvalidClauseException
field
- The field for this queryvalue
- the value to matchInvalidClauseException
- The clause is not valid@Nonnull public DBQuery<T> addMatches(@Nonnull java.lang.String fieldPath, @Nonnull java.lang.String value) throws InvalidClauseException
fieldPath
- The field path for this queryvalue
- the value to matchInvalidClauseException
- The clause is not valid@Nonnull public DBQuery<T> addMatches(@Nonnull DBField field, @Nonnull java.lang.String value) throws InvalidClauseException
field
- The field for this queryvalue
- the value to matchInvalidClauseException
- The clause is not valid@Nonnull public DBQuery<T> addIS(@Nonnull java.lang.String fieldPath, @Nonnull GlobalKey key) throws InvalidClauseException
fieldPath
- The field path for this querykey
- the global keyInvalidClauseException
- The clause is not valid@Nonnull @Deprecated public DBClause addClause(@Nonnull java.lang.String fieldPath, @Nonnull java.lang.String symbol) throws InvalidClauseException
fieldPath
- The field path for this querysymbol
- The symbol for this clauseInvalidClauseException
- The clause is not valid@CheckReturnValue @Nonnull public DBResultGroupBySet groupBy(@Nullable Path[] paths, java.lang.String havingClause) throws java.lang.Exception
paths
- The field paths that results are to be grouped byhavingClause
- An additional filter based on aggregate functionsjava.lang.Exception
- a serious problem.@Nonnull public DBClause addClause(@Nonnull DBClause clause) throws InvalidClauseException
clause
- The clause to add.InvalidClauseException
- The clause is not valid@Nonnull public DBClause addClause(@Nonnull DBField field, @Nonnull java.lang.String symbol) throws InvalidClauseException
field
- The field for the query.symbol
- The symbol for the clauseInvalidClauseException
- The clause is not valid@Nonnull public DBClause addClause(@Nonnull Path path, @Nonnull java.lang.String symbol) throws InvalidClauseException
path
- The path for the clausesymbol
- NULL or NOT NULLInvalidClauseException
- The clause is not valid@Nonnull public DBClause addClause(@Nonnull java.lang.String fieldPath, @Nonnull java.lang.String symbol, java.lang.Object value) throws InvalidClauseException
fieldPath
- The path for the clausesymbol
- The symbol for the clausevalue
- The value for the clauseInvalidClauseException
- The clause is not valid@Nonnull public DBClause addClause(@Nonnull DBField field, @Nonnull java.lang.String symbol, java.lang.Object value) throws InvalidClauseException
field
- The field for the clausesymbol
- The symbolvalue
- The valueInvalidClauseException
- The clause is not valid@Nonnull public DBClause addClause(@Nonnull Path path, @Nonnull java.lang.String symbol, @Nullable java.lang.Object value) throws InvalidClauseException
path
- The path for this clausesymbol
- The symbol for the clausevalue
- The valueInvalidClauseException
- The clause is not valid@Nonnull public DBClause addClause(@Nonnull java.lang.String fieldPath, @Nonnull java.lang.String symbol, @Nonnull GlobalKey value) throws InvalidClauseException
fieldPath
- The path for the clausesymbol
- The symbol for the clausevalue
- The value for the clauseInvalidClauseException
- The clause is not valid@Nonnull @Deprecated public DBClause addClause(@Nonnull java.lang.String fieldPath, @Nonnull java.lang.String symbol, boolean value) throws InvalidClauseException
fieldPath
- The path for the new clausesymbol
- The symbol for the clausevalue
- The value for the clauseInvalidClauseException
- The clause is not valid@Nonnull @CheckReturnValue public DataSource getDS()
@Nonnull public T findOne() throws NotFoundException, TooManyRowsException, java.lang.Exception
NotFoundException
- - The object could not be found that matches criteriaTooManyRowsException
- - There were multiple objects found that matched the criteriajava.lang.Exception
- A serious problem@Nonnull @CheckReturnValue public java.util.stream.Stream<T> stream() throws java.lang.Exception
java.lang.Exception
@Nonnull @CheckReturnValue public DBResult<T> search() throws java.lang.Exception
java.lang.Exception
- A serious problem@Nonnull public DBQuery setSearchPlan(@Nullable SearchPlan plan)
plan
- The plan to use@Nonnull public DBQuery setUseIndexInQuery(boolean useIndex)
useIndex
- Use the indexes or not@CheckReturnValue public boolean useIndexInQuery()
public DBQuery setUseCache(boolean yes)
yes
- Use cache or not@CheckReturnValue public boolean useCache()
@CheckReturnValue public boolean includeDirtyRows()
@Nonnull public DBQuery setDisableDirtyRows(boolean yes)
yes
- include dirty rows or not@Nonnull public DBQuery setUseLinkageCache(boolean yes)
yes
- Use cache or not@CheckReturnValue public boolean useLinkageCache()
@Nonnull public DBQuery setTmeout(long numberOfMilliseconds)
numberOfMilliseconds
- The timeout period.@CheckReturnValue public long getTimeout()
@CheckReturnValue public SearchPlan makeSearchPlan() throws java.lang.Exception
java.lang.Exception
- A serious problem occurs@Nonnull public DBQuery orderBy(java.lang.String fields)
public void call(DALQueryCallBack callBack)
callBack
- the call backstSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.