The world's most popular open source database
Description.
This method is used to perform an index scan of a table, using
NdbRecord. The scan may optionally be
ordered.
Signature.
NdbIndexScanOperation* scanIndex
(
const NdbRecord* key_record,
const char* low_key,
Uint32 low_key_count,
bool low_inclusive,
const char* high_key,
Uint32 high_key_count,
bool high_inclusive,
const NdbRecord* result_record,
NdbOperation::LockMode lock_mode = NdbOperation::LM_Read,
const unsigned char* result_mask = 0,
Uint32 scan_flags = 0,
Uint32 parallel = 0,
Uint32 batch = 0
)
For multi-range scans, the low_key
and high_key pointers must be
unique. In other words, it is not permissible to reuse the
same row buffer for several different range bounds within a
single scan. However, it is permissible to use the same row
pointer as low_key and
high_key in order to specify an
equals bound; it is also permissible to reuse the rows after
the scanIndex() method returns —
thatis, they need not remain valid until
execute() time (unlike the
NdbRecord pointers).
Parameters. This method takes the following parameters:
The key_record describes the
index to be scanned. It must be a key record on the
index; that is, the columns which it specifies must
include all of the key columns of the index. It must be
created from the index to be scanned, and not from the
underlying table.
low_key determines the lower
bound for a range scan.
low_key_count determines the
number of columns used for the lower bound when
specifying a partial prefix for the scan.
low_inclusive determines
whether the lower bound is considered as a
>= or >
relation.
high_key determines the upper
bound for a range scan.
high_key_count determines the
number of columns used for the higher bound when
specifying a partial prefix for the scan.
high_inclusive determines
whether the lower bound is considered as a
<= or <
relation.
The result_record describes
the rows to be returned from the scan. For an ordered
index scan, result_record be
a key record on the index; that is, the columns which it
specifies must include all of the key columns of the
index. This is because the index key is needed for merge
sorting of the scans returned from each fragment.
The lock_mode for the scan
must be one of the values specified in
Section 4.15.1.3, “The NdbOperation::LockMode Type”.
The result_mask pointer is
optional. If it is present, only columns for which the
corresponding bit (by attribute ID order) in
result_mask is set will be
retrieved in the scan. The
result_mask is copied
internally, so in contrast to
result_record need not be
valid when execute() is invoked.
scan_flags can be used to
impose ordering and sorting conditions for scans. See
Section 4.18.1, “The NdbScanOperation::ScanFlag Type”, for a
list of permitted values.
The parallel argument is the
desired parallelism, or 0 for maximum
parallelism (receiving rows from all fragments in
parallel), which is the default.
batch determines whether
batching is employed. The default is 0 (off).
Return Value.
The current NdbIndexScanOperation, which
can be used for error checking.

