public abstract class AbstractQuery extends java.lang.Object implements Joinable
Joinable
interface and provides base services common to all query implementations.P2JQuery.Parameter
Modifier and Type | Field and Description |
---|---|
private java.util.LinkedHashMap<Accumulator,java.lang.Boolean> |
accumulators
Accumulators added to this query, mapped to their deferred status
|
private boolean |
browsed
Is query associated with a UI browse widget?
|
protected boolean |
closed
Flag indicating if this query was explicitly closed.
|
private boolean |
errorIfNull
Should failed first/last/unique retrievals raise error?
|
private RecordBuffer[] |
externalBuffers
Set of external buffers, if any, referenced by this query
|
private boolean |
fetchOnReposition
Should the next row be fetched after a reposition?
|
protected boolean |
inverseSorting
Indicates whether the query has the inverse sorting direction against
the original sorting.
|
private static java.util.logging.Logger |
LOG
Logger
|
private boolean |
notificationActive
Flag to avoid infinite recursion in reposition notification
|
protected ParameterFilter |
parameterFilter
The filter that handles parameters passed to the query.
|
private WeakList<RepositionListener> |
repoRegistry
Registry of listeners who are notified of query repositions
|
private boolean |
standalone
Does this query stand alone or is it contained by a query wrapper ?
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractQuery()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
accumulate()
Notify accumulators attached to this query (if any) that a new result
row has been accessed, and that they should update their internal state.
|
private void |
accumulate(Accumulator accum,
boolean deferred)
Invoke the appropriate
iterate method variant on the
specified accumulator. |
void |
addAccumulator(Accumulator accum)
Add an accumulator to this query.
|
void |
addAccumulator(Accumulator accum,
boolean deferred)
Add an accumulator to this query.
|
logical |
addBuffer(Buffer buf)
Adds one new buffer to a query object or dynamic ProDataSet object,
without affecting the other buffers, if any.
|
logical |
addBuffer(handle bufHandle)
Adds one new buffer to a query object or dynamic ProDataSet object,
without affecting the other buffers, if any.
|
void |
addRepositionListener(RepositionListener listener)
Register a listener to receive notifications reposition events for this
query.
|
protected void |
afterReposition(boolean permitFetch)
This method should be called by subclasses after any reposition of the
query.
|
handle |
bufferHandle()
Conversion of GET-BUFFER-HANDLE() method (KW_GET_BUFH).
|
handle |
bufferHandle(character bufferName)
Conversion of GET-BUFFER-HANDLE() method (KW_GET_BUFH).
|
handle |
bufferHandle(int bufferSequenceNumber)
Conversion of GET-BUFFER-HANDLE() method (KW_GET_BUFH).
|
handle |
bufferHandle(integer bufferSequenceNumber)
Conversion of GET-BUFFER-HANDLE() method (KW_GET_BUFH).
|
handle |
bufferHandle(java.lang.String bufferName)
Conversion of GET-BUFFER-HANDLE() method (KW_GET_BUFH).
|
void |
changeForwardOnly(boolean forwardOnly)
Conversion of FORWARD-ONLY attribute (KW_FWD_ONLY).
|
void |
changeForwardOnly(logical forwardOnly)
Conversion of FORWARD-ONLY attribute (KW_FWD_ONLY).
|
void |
cleanup()
Clean up resources associated with this query when its scope ends.
|
void |
close()
Explicitly close the prepared query.
|
logical |
deleteResultListEntry()
Deletes the current row of a query's result list.
|
logical |
deleteResultListEntry(boolean allowBetweenRows)
Deletes the current row of a query's result list.
|
void |
exclude(DataModelObject dmo,
java.lang.String... fields)
Specifies the fields excluded from a record retrieval.
|
logical |
forwardOnly()
Conversion of FORWARD-ONLY attribute (KW_FWD_ONLY).
|
private static LockType |
fromLockNowait(long lock,
long nowait)
Return LockType instance for the given internal lock and nowait with corresponding query
processing .
|
logical |
getCurrent()
Conversion of GET-CURRENT() method (KW_GET_CUR).
|
logical |
getCurrent(LockType lockType)
Conversion of GET-CURRENT() method (KW_GET_CUR).
|
logical |
getCurrent(long lock)
Conversion of GET-CURRENT() method (KW_GET_CUR).
|
logical |
getCurrent(long lock,
long nowait)
Conversion of GET-CURRENT() method (KW_GET_CUR).
|
logical |
getCurrent(long lock,
NumberType nowait)
Conversion of GET-CURRENT() method (KW_GET_CUR).
|
logical |
getCurrent(NumberType lock)
Conversion of GET-CURRENT() method (KW_GET_CUR).
|
logical |
getCurrent(NumberType lock,
long nowait)
Conversion of GET-CURRENT() method (KW_GET_CUR).
|
logical |
getCurrent(NumberType lock,
NumberType nowait)
Conversion of GET-CURRENT() method (KW_GET_CUR).
|
logical |
getFirst()
Conversion of GET-FIRST method (KW_GET_1ST).
|
logical |
getFirst(LockType lockType)
Conversion of GET-FIRST method (KW_GET_1ST).
|
logical |
getFirst(long lock)
Conversion of GET-FIRST method (KW_GET_1ST).
|
logical |
getFirst(long lock,
long nowait)
Conversion of GET-FIRST method (KW_GET_1ST).
|
logical |
getFirst(long lock,
NumberType nowait)
Conversion of GET-FIRST method (KW_GET_1ST).
|
logical |
getFirst(NumberType lock)
Conversion of GET-FIRST method (KW_GET_1ST).
|
logical |
getFirst(NumberType lock,
long nowait)
Conversion of GET-FIRST method (KW_GET_1ST).
|
logical |
getFirst(NumberType lock,
NumberType nowait)
Conversion of GET-FIRST method (KW_GET_1ST).
|
logical |
getLast()
Conversion of GET-LAST method (KW_GET_LAST).
|
logical |
getLast(LockType lockType)
Conversion of GET-LAST method (KW_GET_LAST).
|
logical |
getLast(long lock)
Conversion of GET-LAST method (KW_GET_LAST).
|
logical |
getLast(long lock,
long nowait)
Conversion of GET-LAST method (KW_GET_LAST).
|
logical |
getLast(long lock,
NumberType nowait)
Conversion of GET-LAST method (KW_GET_LAST).
|
logical |
getLast(NumberType lock)
Conversion of GET-LAST method (KW_GET_LAST).
|
logical |
getLast(NumberType lock,
long nowait)
Conversion of GET-LAST method (KW_GET_LAST).
|
logical |
getLast(NumberType lock,
NumberType nowait)
Conversion of GET-LAST method (KW_GET_LAST).
|
logical |
getNext()
Conversion of GET-NEXT method (KW_GET_NEXT).
|
logical |
getNext(LockType lockType)
Conversion of GET-NEXT method (KW_GET_NEXT).
|
logical |
getNext(long lock)
Conversion of GET-NEXT method (KW_GET_NEXT).
|
logical |
getNext(long lock,
long nowait)
Conversion of GET-NEXT method (KW_GET_NEXT).
|
logical |
getNext(long lock,
NumberType nowait)
Conversion of GET-NEXT method (KW_GET_NEXT).
|
logical |
getNext(NumberType lock)
Conversion of GET-NEXT method (KW_GET_NEXT).
|
logical |
getNext(NumberType lock,
long nowait)
Conversion of GET-NEXT method (KW_GET_NEXT).
|
logical |
getNext(NumberType lock,
NumberType nowait)
Conversion of GET-NEXT method (KW_GET_NEXT).
|
integer |
getNumResults()
Conversion of NUM-RESULTS attribute (KW_NUM_RES).
|
logical |
getPrevious()
Conversion of GET-PREV method (KW_GET_PREV).
|
logical |
getPrevious(LockType lockType)
Conversion of GET-PREV method (KW_GET_PREV).
|
logical |
getPrevious(long lock)
Conversion of GET-PREV method (KW_GET_PREV).
|
logical |
getPrevious(long lock,
long nowait)
Conversion of GET-PREV method (KW_GET_PREV).
|
logical |
getPrevious(long lock,
NumberType nowait)
Conversion of GET-PREV method (KW_GET_PREV).
|
logical |
getPrevious(NumberType lock)
Conversion of GET-PREV method (KW_GET_PREV).
|
logical |
getPrevious(NumberType lock,
long nowait)
Conversion of GET-PREV method (KW_GET_PREV).
|
logical |
getPrevious(NumberType lock,
NumberType nowait)
Conversion of GET-PREV method (KW_GET_PREV).
|
RecordBuffer[] |
getReferencedBuffers()
Get an array of all record buffers referenced by this query, including those directly
involved in the query, as well as those (if any) indirectly referenced by inlined,
converted, CAN-FIND expressions.
|
protected boolean |
hasAccumulators()
Check if query has attached accumulators.
|
logical |
hasAny()
Indicate whether a request to find the first result of this query would
succeed or fail.
|
logical |
hasAny(LockType lockType)
Indicate whether a request to find the first result of this query would
succeed or fail.
|
logical |
hasAny(java.lang.Object[] values)
Indicate whether a request to find the first result of this query would
succeed or fail.
|
logical |
hasAny(java.lang.Object[] values,
LockType lockType)
Indicate whether a request to find the first result of this query would
succeed or fail.
|
logical |
hasOne()
Indicate whether this query would produce a unique result.
|
logical |
hasOne(LockType lockType)
Indicate whether this query would produce a unique result.
|
logical |
hasOne(java.lang.Object[] values)
Indicate whether this query would produce a unique result.
|
logical |
hasOne(java.lang.Object[] values,
LockType lockType)
Indicate whether this query would produce a unique result.
|
void |
include(DataModelObject dmo,
java.lang.String... fields)
Specifies the fields included in a record retrieval.
|
character |
indexInformation()
Conversion of INDEX-INFORMATION attribute (KW_IDX_INFO).
|
character |
indexInformation(int n)
Conversion of INDEX-INFORMATION attribute (KW_IDX_INFO).
|
character |
indexInformation(NumberType n)
Conversion of INDEX-INFORMATION attribute (KW_IDX_INFO).
|
boolean |
isBrowsed()
Report whether this query is associated with a browse widget.
|
protected boolean |
isErrorIfNull()
Indicate whether failed
FIRST , LAST , and
UNIQUE retrieval attempts should be considered an error
condition. |
boolean |
isFetchOnReposition()
Is this query set to fetch the next record after a reposition?
|
protected boolean |
isLastOfBreakGroup(Resolvable key)
Determine whether the query result row currently being visited is the
last row within a break group whose category is identified by the
specified resolvable object.
|
protected boolean |
isNewBreakGroup(Resolvable key)
Subclasses which support the concept of break groups in query results
should override this method to report whether the current result row
being visited represents a new break group, for the given break group
key.
|
logical |
isOffEnd()
Indicate whether the cursor has run off one or the other end of the
associated query's list of available results.
|
logical |
isOpen()
Conversion of IS-OPEN attribute (KW_IS_OPEN).
|
protected boolean |
isRepositionNotificationActive()
Indicate if we are currently notifying listeners of a reposition event.
|
logical |
isSkipDeletedRecord()
Get value of SKIP-DELETED-RECORD attribute of the query.
|
boolean |
isStandalone()
Indicate whether this query stands alone, or is wrapped by a query
wrapper.
|
protected void |
loadRowAtCursor()
Synchronize the query with the cursor by causing the query to load the
current row's results (if any) into its backing buffer(s).
|
void |
notifyRepositionListeners(boolean closed,
boolean error,
int targetRepositionRow)
Notify all registered listeners that query is repositioned or closed.
|
integer |
numBuffers()
Conversion of NUM-BUFFERS() method (KW_NUM_BUFF).
|
static integer |
numResults(character queryName)
Implementation of NUM-RESULTS P4GL function.
|
static integer |
numResults(P2JQuery query)
Implementation of NUM-RESULTS P4GL function.
|
void |
open()
Reposition the prepared query to the first result if the query is being
browsed.
|
void |
optimize()
Attempt to optimize this query.
|
logical |
prepare(character predicate)
Compiles a predicate (query condition).
|
logical |
prepare(java.lang.String predicate)
Compiles a predicate (query condition).
|
protected boolean |
prepareFetch()
Prepare to perform a fetch.
|
character |
prepareString()
Conversion of PREPARE_STRING attribute (KW_PREP_STR).
|
protected static void |
preprocessSubstitutionArguments(BufferManager bufMgr,
java.lang.Object[] args)
Iterate the array of query substitution parameters, if any, and resolve any which are
instances of
P2JQuery.Parameter in silent error mode. |
logical |
queryBackward(int rows)
Conversion of REPOSITION-BACKWARD() method (KW_REPOS_B).
|
logical |
queryBackward(NumberType rows)
Conversion of REPOSITION-BACKWARD() method (KW_REPOS_B).
|
logical |
queryClose()
Conversion of QUERY-CLOSE() method (KW_QRY_CLOS).
|
logical |
queryForward(int rows)
Conversion of REPOSITION-FORWARD() method (KW_REPOS_F).
|
logical |
queryForward(NumberType rows)
Conversion of REPOSITION-FORWARD() method (KW_REPOS_F).
|
logical |
queryOpen()
Opens a query object.
|
logical |
queryReposition(int n)
Conversion of REPOSITION-TO-ROW() method (KW_REPOS_2R).
|
logical |
queryReposition(NumberType n)
Conversion of REPOSITION-TO-ROW() method (KW_REPOS_2R).
|
logical |
queryRepositionByID(rowid id1,
rowid... joinIDs)
Conversion of REPOSITION-TO-ROWID() method (KW_REPOS_2I).
|
protected void |
releaseBuffers()
Default, no-op implementation which should be overridden by subclasses
which need to release the current record of each of their buffers in
response to a fetch request while an error is pending in the error
manager.
|
void |
removeRepositionListener(RepositionListener listener)
Unregister a listener that was receiving notifications on reposition events for this
query.
|
void |
setBrowsed(boolean browsed)
Indicate to this query that whether it is associated with a browse
widget or not.
|
logical |
setBuffers(Buffer... bufs)
Sets buffers for the query.
|
logical |
setBuffers(handle... hBuffers)
Sets buffers for the query.
|
void |
setErrorIfNull(boolean errorIfNull)
Set a mode such that setting a null record into a backing buffer may or
may not result in an error condition.
|
P2JQuery |
setExternalBuffers(DataModelObject... dmos)
Set one or more buffers which this query references externally.
|
void |
setFetchOnReposition(boolean enable)
Set this query to automatically fetch the next record after a
reposition, or turn this feature off.
|
void |
setParameterFilter(ParameterFilter parameterFilter)
Set the filter that handles parameters passed to the query.
|
void |
setScrolling()
Enable results list scrolling/repositioning.
|
void |
setSkipDeletedRecord(logical on)
Setter for SKIP-DELETED-RECORD query attribute.
|
void |
setStandalone(boolean standalone)
Change the standalone nature of this query.
|
protected static void |
validateSubstitutionArguments(java.lang.Object[] args)
Verify that an array of query substitution arguments contains only
BaseDataType and/or Resolvable elements. |
private logical |
wrapCurrent(LockType lockType)
Worker method for wrapping ErrorConditionException and reusing
in all P2JQuery.getCurrent() implementations
|
private logical |
wrapFirst(LockType lockType)
Worker method for wrapping ErrorConditionException and reusing
in all P2JQuery.getFirst() implementations
|
private logical |
wrapLast(LockType lockType)
Worker method for wrapping ErrorConditionException and reusing
in all P2JQuery.getLast() implementations
|
private logical |
wrapNext(LockType lockType)
Worker method for wrapping ErrorConditionException and reusing
in all P2JQuery.getNext() implementations
|
private logical |
wrapPrevious(LockType lockType)
Worker method for wrapping ErrorConditionException and reusing
in all P2JQuery.getPrevious() implementations
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forceDynamicOperation, getArgs, getJoin, getOriginalWhere, getRecordBuffers, getRow, getSortPhrase, hasWhereExpression, load, makeAdaptiveServerJoinComponent, makePreselectServerJoinComponent, peekFirst, peekLast, registerRecordChangeListeners, reset, setFullRecords, setResults, setUnknownRecord
peekNext, peekPrevious
_isOffEnd, backward, backward, close, current, current, currentRow, currentRowImpl, first, first, forward, forward, getOffEnd, getOffEndListeners, getTableCount, isNativelyPreselect, isPreselect, isScrolling, last, last, next, next, previous, previous, reposition, reposition, repositionByID, repositionByID, size, unique, unique
private static final java.util.logging.Logger LOG
protected boolean inverseSorting
find next tt use-index si-name. find prev tt use-index si-name.will be converted to the code having a couple of AdaptiveFind queries:
AdaptiveFind query1 = new AdaptiveFind(tt, null, "tt.name asc"); AdaptiveFind query2 = new AdaptiveFind(tt, null, "tt.name desc", true);and the second query will have the inverse sorting direction.
protected boolean closed
protected ParameterFilter parameterFilter
private boolean errorIfNull
private boolean standalone
private boolean fetchOnReposition
private boolean browsed
private java.util.LinkedHashMap<Accumulator,java.lang.Boolean> accumulators
private WeakList<RepositionListener> repoRegistry
private boolean notificationActive
private RecordBuffer[] externalBuffers
public static integer numResults(character queryName)
queryName
- A character
expression that evaluates to the name of a currently open,
scrolling query.queryName
does not resolve to the name of a query, or if the query is not open or
not scrolling, then the function returns the Unknown value (?
).public static integer numResults(P2JQuery query)
query
- A character
expression that evaluates to the name of a currently open,
scrolling query.queryName
does not resolve to the name of a query, or if the query is not open or
not scrolling, then the function returns the Unknown value (?
).protected static void validateSubstitutionArguments(java.lang.Object[] args)
BaseDataType
and/or Resolvable
elements.
A null
argument is permissible only if the error manager
has an error pending. We don't throw an exception in this case, as the
error will be processed later.
args
- Query substitution arguments to be validated.java.lang.IllegalArgumentException
- if args
is not null
, but contains
invalid argument types.protected static void preprocessSubstitutionArguments(BufferManager bufMgr, java.lang.Object[] args)
P2JQuery.Parameter
in silent error mode.
Those one which are instances of Resolvable are resolved in normal mode
An important secondary purpose of this method is to check whether we are processing a query within the context of another query and raising an error condition if this is the case.
bufMgr
- BufferManager
instance for the current user context.args
- Array of query substitution arguments, or null
if there are none.private static LockType fromLockNowait(long lock, long nowait) throws ErrorConditionException
lock
- Integer value.nowait
- Integer value.LockType
instance.ErrorConditionException
public void setScrolling()
setScrolling
in interface P2JQuery
public void open()
public void optimize()
public logical isOffEnd()
true
,
this indicates that the query cannot produce any more results in the
current scroll direction.public void addAccumulator(Accumulator accum)
This implementation assumes the accumulator is not associated with a break group.
addAccumulator
in interface P2JQuery
accum
- Accumulator to be registered with this query.public void addAccumulator(Accumulator accum, boolean deferred)
This implementation assumes the accumulator is not associated with a break group.
addAccumulator
in interface P2JQuery
accum
- Accumulator to be registered with this query.deferred
- If true
, calls to accumulate()
will not
cause the accumulator to recalculate immediately, but instead
to update the accumulator's state such that the next invocation
of Accumulator.accumulate()
will
trigger the actual accumulation update. If false
,
the accumulator recalculates its internal state immediatelypublic boolean isFetchOnReposition()
isFetchOnReposition
in interface P2JQuery
true
if set to fetch after reposition, else
false
.public void setFetchOnReposition(boolean enable)
setFetchOnReposition
in interface P2JQuery
enable
- true
to enable automatic fetching;
false
to disable.public void addRepositionListener(RepositionListener listener)
addRepositionListener
in interface P2JQuery
listener
- Reposition listener to be registered.public void removeRepositionListener(RepositionListener listener)
removeRepositionListener
in interface P2JQuery
listener
- Reposition listener to be unregistered.public void setBrowsed(boolean browsed)
setBrowsed
in interface P2JQuery
browsed
- true
to indicate the query has an associated
browse widget, else false
.public void notifyRepositionListeners(boolean closed, boolean error, int targetRepositionRow)
notifyRepositionListeners
in interface P2JQuery
closed
- A true
value will inform all listeners that the query was explicitly
closed.error
- true
if an error happened during reposition.targetRepositionRow
- Row used as the target for reposition. If it was deleted, reposition with fetching
may end up on a different row.public boolean isStandalone()
isStandalone
in interface P2JQuery
true
if standalone, else false
.public void setStandalone(boolean standalone)
setStandalone
in interface P2JQuery
standalone
- true
to set query as standalone;
false
to set query as contained.public void cleanup()
This default implementation does nothing.
public void close()
This default implementation calls cleanup()
.
public void setErrorIfNull(boolean errorIfNull)
FIRST
, LAST
, and UNIQUE
records.setErrorIfNull
in interface Joinable
setErrorIfNull
in interface P2JQuery
errorIfNull
- If true
, setting a null
value as the
current record in an underlying buffer will raise an error
condition (if not in silent error mode); if false
,
this action will raise an end condition instead.public boolean isBrowsed()
public P2JQuery setExternalBuffers(DataModelObject... dmos)
This method is optional, but if called, it should only be called once, before the query is executed.
setExternalBuffers
in interface P2JQuery
dmos
- One or more external buffers.public RecordBuffer[] getReferencedBuffers()
getReferencedBuffers
in interface Joinable
protected boolean isErrorIfNull()
FIRST
, LAST
, and
UNIQUE
retrieval attempts should be considered an error
condition.true
if failed first/last/unique retrievals
should be considered an error; false
is such
failures should be considered a query off-end condition.protected void afterReposition(boolean permitFetch)
P2JQuery.next()
method). If any listeners are
registered to receive notifications of reposition events, they are
notified now.permitFetch
- true
to permit immediate record fetch;
false
to override fetchOnReposition
flag and explicitly disallow immediate record fetch.protected boolean isRepositionNotificationActive()
true
if a reposition notification is active, else
false
.protected void loadRowAtCursor()
This implementation does nothing; it should be overridden to implement this behavior as needed.
protected final void accumulate()
protected boolean hasAccumulators()
true
if accumulators attached to the query.protected boolean isNewBreakGroup(Resolvable key)
key
- Resolvable object which is used as the key to identify the
break group category being tested.true
if the current result represents the first
entry in a new break group; else false
. This
default implementation always returns false
.protected boolean isLastOfBreakGroup(Resolvable key)
key
- Break group category key. May be null
(which
should always trigger a false
return).false
; subclasses should override this method if
a different result is required.protected boolean prepareFetch()
false
if an error is pending, else
true
.protected void releaseBuffers()
private void accumulate(Accumulator accum, boolean deferred)
iterate
method variant on the
specified accumulator. If the accumulator manages only a primary
statistic (i.e., no break groups have been added), the simple form
is invoked. If break groups have been added to the accumulator, the
more complex form
is invoked.accum
- Target accumulator object.deferred
- true
if the accumulator was registered to this
query as a deferred accumulator, else false
.addAccumulator(com.goldencode.p2j.util.Accumulator)
public handle bufferHandle()
bufferHandle
in interface P2JQuery
public handle bufferHandle(java.lang.String bufferName)
bufferHandle
in interface P2JQuery
bufferName
- buffer-name. A CHARACTER expression that evaluates to the name
of a buffer in the query or ProDataSet object.public handle bufferHandle(character bufferName)
bufferHandle
in interface P2JQuery
bufferName
- buffer-name. A CHARACTER expression that evaluates to the name
of a buffer in the query or ProDataSet object.public handle bufferHandle(int bufferSequenceNumber)
bufferHandle
in interface P2JQuery
bufferSequenceNumber
- buffer-sequence-number. An INTEGER that represents the sequence
number of the desired buffer.public handle bufferHandle(integer bufferSequenceNumber)
bufferHandle
in interface P2JQuery
bufferSequenceNumber
- buffer-sequence-number. An INTEGER that represents the sequence
number of the desired buffer.public logical queryClose()
queryClose
in interface P2JQuery
true
if QUERY-CLOSE() succeeds,
else false
.public logical queryBackward(NumberType rows)
queryBackward
in interface P2JQuery
true
if REPOSITION-BACKWARD() succeeds,
else false
.public logical queryBackward(int rows)
queryBackward
in interface P2JQuery
true
if REPOSITION-BACKWARD() succeeds,
else false
.public logical queryForward(NumberType rows)
queryForward
in interface P2JQuery
true
if REPOSITION-FORWARD() succeeds,
else false
.public logical queryForward(int rows)
queryForward
in interface P2JQuery
true
if REPOSITION-FORWARD() succeeds,
else false
.public logical queryReposition(int n)
queryReposition
in interface P2JQuery
n
- An integer expression representing the sequence number.true
if REPOSITION-TO-ROW() succeeds,
else false
.public logical queryReposition(NumberType n)
queryReposition
in interface P2JQuery
n
- An integer expression representing the sequence number.true
if REPOSITION-TO-ROW() succeeds,
else false
.public logical queryRepositionByID(rowid id1, rowid... joinIDs)
queryRepositionByID
in interface P2JQuery
id1
- A primary key ID, representing the target record (in the case
of a join, this ID is associated with the left-most record in
the join).joinIDs
- All remaining primary key IDs, if any, arranged from left to
right to coincide with the records being joined by the
underlying query.true
if REPOSITION-TO-ROWID() succeeds,
else false
.public integer getNumResults()
getNumResults
in interface P2JQuery
public logical addBuffer(handle bufHandle)
public logical addBuffer(Buffer buf)
public logical setBuffers(handle... hBuffers)
addBuffer()
method to add one
buffer to the object, without affecting the other buffers, if any.
This method is the equivalent of SET-BUFFERS()
method
from 4GL.setBuffers
in interface P2JQuery
hBuffers
- Variable argument list of buffer handles to be set.
In 4GL, the maximum number of buffers per query is 18.public logical setBuffers(Buffer... bufs)
addBuffer()
method to add one
buffer to the object, without affecting the other buffers, if any.
This method is the equivalent of SET-BUFFERS()
method
from 4GL.setBuffers
in interface P2JQuery
bufs
- Variable argument list of Buffer to be set.
In 4GL, the maximum number of buffers per query is 18.public logical prepare(java.lang.String predicate)
QUERY-PREPARE()
method from 4GL.public logical prepare(character predicate)
QUERY-PREPARE()
method from 4GL.public logical queryOpen()
QUERY-OPEN()
method from 4GL.
Note: You must perform prepare()
on a query
object before you perform queryOpen
on it.public character indexInformation()
indexInformation
in interface IndexInformation
indexInformation
in interface P2JQuery
public character indexInformation(int n)
indexInformation
in interface IndexInformation
indexInformation
in interface P2JQuery
n
- An integer expression that evaluates to the level of join for which you want
index information.public character indexInformation(NumberType n)
indexInformation
in interface IndexInformation
indexInformation
in interface P2JQuery
n
- An integer expression that evaluates to the level of join for which you want index
information.public logical forwardOnly()
forwardOnly
in interface P2JQuery
public void changeForwardOnly(logical forwardOnly)
changeForwardOnly
in interface P2JQuery
forwardOnly
- New value of FORWARD-ONLY attribute.public void changeForwardOnly(boolean forwardOnly)
changeForwardOnly
in interface P2JQuery
forwardOnly
- New value of FORWARD-ONLY attribute.public character prepareString()
prepareString
in interface P2JQuery
public logical isOpen()
public logical getNext()
getNext
in interface P2JQuery
true
if the next record in the query is found. If the query is not
open or the next record cannot be found (query is empty or the query result list
pointer is on the last row), the method returns false
. If the query
object handle is invalid, the method returns the Unknown value (?).public logical getNext(LockType lockType)
getNext
in interface P2JQuery
lockType
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue
if the next record in the query is found. If the query is not
open or the next record cannot be found (query is empty or the query result list
pointer is on the last row), the method returns false
. If the query
object handle is invalid, the method returns the Unknown value (?).public logical getNext(long lock)
getNext
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue
if the next record in the query is found. If the query is not
open or the next record cannot be found (query is empty or the query result list
pointer is on the last row), the method returns false
. If the query
object handle is invalid, the method returns the Unknown value (?).ErrorConditionException
public logical getNext(NumberType lock)
getNext
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue
if the next record in the query is found. If the query is not
open or the next record cannot be found (query is empty or the query result list
pointer is on the last row), the method returns false
. If the query
object handle is invalid, the method returns the Unknown value (?).ErrorConditionException
public logical getNext(long lock, long nowait)
getNext
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if the next record in the query is found. If the query is not
open or the next record cannot be found (query is empty or the query result list
pointer is on the last row), the method returns false
. If the query
object handle is invalid, the method returns the Unknown value (?).ErrorConditionException
public logical getNext(long lock, NumberType nowait)
getNext
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if the next record in the query is found. If the query is not
open or the next record cannot be found (query is empty or the query result list
pointer is on the last row), the method returns false
. If the query
object handle is invalid, the method returns the Unknown value (?).ErrorConditionException
public logical getNext(NumberType lock, long nowait)
getNext
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if the next record in the query is found. If the query is not
open or the next record cannot be found (query is empty or the query result list
pointer is on the last row), the method returns false
. If the query
object handle is invalid, the method returns the Unknown value (?).ErrorConditionException
public logical getNext(NumberType lock, NumberType nowait)
getNext
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if the next record in the query is found. If the query is not
open or the next record cannot be found (query is empty or the query result list
pointer is on the last row), the method returns false
. If the query
object handle is invalid, the method returns the Unknown value (?).ErrorConditionException
public logical getPrevious()
getPrevious
in interface P2JQuery
true
if the previous record in the query is found. If the query is
not open or the previous record cannot be found (query is empty or the query
result list pointer is on the first row), the method returns false
.
If the query object handle is invalid, the method returns the Unknown value (?).public logical getPrevious(long lock)
getPrevious
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue
if the previous record in the query is found. If the query is
not open or the previous record cannot be found (query is empty or the query
result list pointer is on the first row), the method returns false
.
If the query object handle is invalid, the method returns the Unknown value (?).ErrorConditionException
public logical getPrevious(LockType lockType)
getPrevious
in interface P2JQuery
lockType
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue
if the previous record in the query is found. If the query is
not open or the previous record cannot be found (query is empty or the query
result list pointer is on the first row), the method returns false
.
If the query object handle is invalid, the method returns the Unknown value (?).java.lang.IllegalArgumentException
- if lock
has not valid internal value.public logical getPrevious(NumberType lock)
getPrevious
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue
if the previous record in the query is found. If the query is
not open or the previous record cannot be found (query is empty or the query
result list pointer is on the first row), the method returns false
.
If the query object handle is invalid, the method returns the Unknown value (?).ErrorConditionException
public logical getPrevious(long lock, long nowait)
getPrevious
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if the previous record in the query is found. If the query is
not open or the previous record cannot be found (query is empty or the query
result list pointer is on the first row), the method returns false
.
If the query object handle is invalid, the method returns the Unknown value (?).ErrorConditionException
public logical getPrevious(NumberType lock, long nowait)
getPrevious
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if the previous record in the query is found. If the query is
not open or the previous record cannot be found (query is empty or the query
result list pointer is on the first row), the method returns false
.
If the query object handle is invalid, the method returns the Unknown value (?).ErrorConditionException
public logical getPrevious(long lock, NumberType nowait)
getPrevious
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if the previous record in the query is found. If the query is
not open or the previous record cannot be found (query is empty or the query
result list pointer is on the first row), the method returns false
.
If the query object handle is invalid, the method returns the Unknown value (?).ErrorConditionException
public logical getPrevious(NumberType lock, NumberType nowait)
getPrevious
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if the previous record in the query is found. If the query is
not open or the previous record cannot be found (query is empty or the query
result list pointer is on the first row), the method returns false
.
If the query object handle is invalid, the method returns the Unknown value (?).ErrorConditionException
public logical getFirst()
public logical getFirst(long lock)
getFirst
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue
if the first record in the query is found. If the query is not
open or the first record cannot be found (query is empty), the method returns
false
. If the query object handle is invalid, the method returns
the Unknown value (?).java.lang.IllegalArgumentException
- if lock
has not valid internal value.ErrorConditionException
public logical getFirst(NumberType lock)
getFirst
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue
if the first record in the query is found. If the query is not
open or the first record cannot be found (query is empty), the method returns
false
. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException
public logical getFirst(LockType lockType)
getFirst
in interface P2JQuery
lockType
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue
if the first record in the query is found. If the query is not
open or the first record cannot be found (query is empty), the method returns
false
. If the query object handle is invalid, the method returns
the Unknown value (?).java.lang.IllegalArgumentException
- if lock
has not valid internal value.public logical getFirst(long lock, long nowait)
getFirst
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if the first record in the query is found. If the query is not
open or the first record cannot be found (query is empty), the method returns
false
. If the query object handle is invalid, the method returns
the Unknown value (?).java.lang.IllegalArgumentException
- if lock
or nowait
have not valid internal values.ErrorConditionException
public logical getFirst(NumberType lock, long nowait)
getFirst
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if the first record in the query is found. If the query is not
open or the first record cannot be found (query is empty), the method returns
false
. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException
public logical getFirst(long lock, NumberType nowait)
getFirst
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if the first record in the query is found. If the query is not
open or the first record cannot be found (query is empty), the method returns
false
. If the query object handle is invalid, the method returns
the Unknown value (?).java.lang.IllegalArgumentException
- if lock
or nowait
have not valid internal values.ErrorConditionException
public logical getFirst(NumberType lock, NumberType nowait)
getFirst
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if the first record in the query is found. If the query is not
open or the first record cannot be found (query is empty), the method returns
false
. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException
public logical getLast()
public logical getLast(long lock)
getLast
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue
if the last record in the query is found. If the query is not
open or the last record cannot be found (query is empty), the method returns
false
. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException
public logical getLast(NumberType lock)
getLast
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue
if the last record in the query is found. If the query is not
open or the last record cannot be found (query is empty), the method returns
false
. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException
public logical getLast(LockType lockType)
getLast
in interface P2JQuery
lockType
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue
if the last record in the query is found. If the query is not
open or the last record cannot be found (query is empty), the method returns
false
. If the query object handle is invalid, the method returns
the Unknown value (?).java.lang.IllegalArgumentException
- if lock
has not valid internal value.public logical getLast(long lock, long nowait)
getLast
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if the last record in the query is found. If the query is not
open or the last record cannot be found (query is empty), the method returns
false
. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException
public logical getLast(NumberType lock, long nowait)
getLast
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if the last record in the query is found. If the query is not
open or the last record cannot be found (query is empty), the method returns
false
. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException
public logical getLast(long lock, NumberType nowait)
getLast
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if the last record in the query is found. If the query is not
open or the last record cannot be found (query is empty), the method returns
false
. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException
public logical getLast(NumberType lock, NumberType nowait)
getLast
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if the last record in the query is found. If the query is not
open or the last record cannot be found (query is empty), the method returns
false
. If the query object handle is invalid, the method returns
the Unknown value (?).ErrorConditionException
public logical getCurrent()
getCurrent
in interface P2JQuery
true
if GET-CURRENT() succeeds, else false
.public logical getCurrent(long lock)
getCurrent
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue
if GET-CURRENT() succeeds, else false
.ErrorConditionException
public logical getCurrent(NumberType lock)
getCurrent
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKtrue
if GET-CURRENT() succeeds, else false
.ErrorConditionException
public logical getCurrent(LockType lockType)
getCurrent
in interface P2JQuery
lockType
- of LockTypetrue
if GET-CURRENT() succeeds, else false
.public logical getCurrent(long lock, long nowait)
getCurrent
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if GET-CURRENT() succeeds, else false
.ErrorConditionException
public logical getCurrent(NumberType lock, long nowait)
getCurrent
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if GET-CURRENT() succeeds, else false
.ErrorConditionException
public logical getCurrent(long lock, NumberType nowait)
getCurrent
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if GET-CURRENT() succeeds, else false
.ErrorConditionException
public logical getCurrent(NumberType lock, NumberType nowait)
getCurrent
in interface P2JQuery
lock
- SHARE-LOCK|EXCLUSIVE-LOCK|NO-LOCKnowait
- NO-WAITtrue
if GET-CURRENT() succeeds, else false
.ErrorConditionException
public logical hasAny()
Default substitution arguments and a lock type of NONE
are
used for this test.
public logical hasAny(java.lang.Object[] values)
The specified substitution arguments and a lock type of
NONE
are used for this test.
public logical hasAny(LockType lockType)
Default substitution arguments and the specified lock type are used for this test.
public logical hasAny(java.lang.Object[] values, LockType lockType)
The specified substitution arguments and lock type are used for this test.
hasAny
in interface P2JQuery
values
- Query substitution parameters.lockType
- Lock type for the query. This lock is not actually acquired,
only tested for availability.true
if the first record exists, else false
.java.lang.UnsupportedOperationException
- always.public logical hasOne()
Default substitution arguments and a lock type of NONE
are
used for this test.
public logical hasOne(java.lang.Object[] values)
The specified substitution arguments and a lock type of
NONE
are used for this test.
public logical hasOne(LockType lockType)
Default substitution arguments and the specified lock type are used for this test.
public logical hasOne(java.lang.Object[] values, LockType lockType)
The specified substitution arguments and lock type are used for this test.
hasOne
in interface P2JQuery
values
- Query substitution parameters.lockType
- Lock type for the query. This lock is not actually acquired,
only tested for availability.true
if any record matching the query's criteria
exists, else false
.java.lang.UnsupportedOperationException
- always.public void include(DataModelObject dmo, java.lang.String... fields)
include
in interface P2JQuery
dmo
- DMO proxy which defines the buffer for which the fields are specified.fields
- The fields included in a record retrieval. If no fields are specified, only record
identifiers are retrieved. No subscripts can be specified for extent fields.public void exclude(DataModelObject dmo, java.lang.String... fields)
public integer numBuffers()
numBuffers
in interface P2JQuery
public logical deleteResultListEntry()
deleteResultListEntry
in interface P2JQuery
true
on success.public logical deleteResultListEntry(boolean allowBetweenRows)
deleteResultListEntry
in interface P2JQuery
allowBetweenRows
- If true
then the cursor can be positioned between rows (the next
row will be deleted). false
for conventional DELETE-RESULT-LIST-ENTRY()
mode where the cursor should be positioned on a row (otherwise false
is
returned).public void setSkipDeletedRecord(logical on)
setSkipDeletedRecord
in interface P2JQuery
on
- New value for the attribute.public logical isSkipDeletedRecord()
isSkipDeletedRecord
in interface P2JQuery
public void setParameterFilter(ParameterFilter parameterFilter)
setParameterFilter
in interface P2JQuery
parameterFilter
- The filter that handles passed parameters.private logical wrapNext(LockType lockType)
lockType
- instance of LockTypetrue
if GET-NEXT() succeeds, else false
.private logical wrapPrevious(LockType lockType)
lockType
- instance of LockTypetrue
if GET-PREV() succeeds, else false
.private logical wrapFirst(LockType lockType)
lockType
- instance of LockTypetrue
if GET-FIRST() succeeds, else false
.private logical wrapLast(LockType lockType)
lockType
- instance of LockTypetrue
if GET-LAST() succeeds, else false
.