2.3.27.2 NdbScanFilter Methods

2.3.27.2.1 NdbScanFilter Class Constructor
2.3.27.2.2 NdbScanFilter::begin()
2.3.27.2.3 NdbScanFilter::cmp()
2.3.27.2.4 NdbScanFilter::end()
2.3.27.2.5 NdbScanFilter::eq()
2.3.27.2.6 NdbScanFilter::isfalse()
2.3.27.2.7 NdbScanFilter::isnotnull()
2.3.27.2.8 NdbScanFilter::isnull()
2.3.27.2.9 NdbScanFilter::istrue()
2.3.27.2.10 NdbScanFilter::ge()
2.3.27.2.11 NdbScanFilter::getNdbError()
2.3.27.2.12 NdbScanFilter::getNdbOperation()
2.3.27.2.13 NdbScanFilter::gt()
2.3.27.2.14 NdbScanFilter::le()
2.3.27.2.15 NdbScanFilter::lt()
2.3.27.2.16 NdbScanFilter::ne()

Abstract

This section lists and describes the public methods of the NdbScanFilter class.

2.3.27.2.1 NdbScanFilter Class Constructor

Description.  This is the constructor method for NdbScanFilter, and creates a new instance of the class.

Signature. 

NdbScanFilter
    (
      class NdbOperation* op
    )

Parameters.  This method takes a single parameter, a pointer to the NdbOperation to which the filter applies.

Return value.  A new instance of NdbScanFilter.

Destructor.  The destructor takes no arguments and does not return a value. It should be called to remove the NdbScanFilter object when it is no longer needed.

2.3.27.2.2 NdbScanFilter::begin()

Description.  This method is used to start a compound, and specifies the logical operator used to group the conditions making up the compound. The default is AND.

Signature. 

int begin
    (
      Group group = AND
    )

Parameters.  A Group value: one of AND, OR, NAND, or NOR. See Section 2.3.27.1.2, “The NdbScanFilter::Group Type”, for additional information.

Return value.  0 on success, -1 on failure.

2.3.27.2.3 NdbScanFilter::cmp()

Description.  This method is used to define a comparison between a given value and the value of a column. (This method does not actually execute the comparison, which is done later when performing the scan for which this NdbScanFilter is defined.)

Note

In many cases, where the value to be compared is an integer, you can instead use one of several convenience methods provided by NdbScanFilter for this purpose. See NdbScanFilter Integer Comparison Methods.

Signature. 

int cmp
    (
      BinaryCondition condition,
      int columnId,
      const void* value,
      Uint32 length = 0
    )

Parameters.  This method takes the following parameters:

  • condition: This represents the condition to be tested which compares the value of the column having the column ID columnID with some arbitrary value. The condition is a BinaryCondition value; for permitted values and the relations that they represent, see Section 2.3.27.1.1, “The NdbScanFilter::BinaryCondition Type”.

    The condition values COND_LIKE or COND_NOTLIKE are used to compare a column value with a string pattern.

  • columnId: This is the column's identifier, which can be obtained using the Column::getColumnNo() method.

  • value: The value to be compared, repesented as a pointer to void.

    When using a COND_LIKE or COND_NOTLIKE comparison condition, the value is treated as a string pattern. This string must not be padded or use a prefix. The string value can include the pattern metacharacters or wildcard characters % and _, which have the meanings shown here:

    MetacharacterDescription
    %Matches zero or more characters
    _Matches exactly one character

    To match against a literal % or _ character, use the backslash (\) as an escape character. To match a literal \ character, use \\.

    Note

    These are the same wildcard characters that are supported by the SQL LIKE and NOT LIKE operators, and are interpreted in the same way. See String Comparison Functions, for more information.

  • length: The length of the value to be compared. The default value is 0. Using 0 for the length has the same effect as comparing to NULL, that is using the isnull() method.

Return value.  This method returns an integer: 0 on success, and -1 on failure.

2.3.27.2.4 NdbScanFilter::end()

Description.  This method completes a compound, signalling that there are no more conditions to be added to it.

Signature. 

int end
    (
      void
    )

Parameters.  None.

Return value.  Returns 0 on success, or -1 on failure.

2.3.27.2.5 NdbScanFilter::eq()

Description.  This method is used to perform an equality test on a column value and an integer.

Signature. 

int eq
    (
      int    ColId,
      Uint32 value
    )

or

int eq
    (
      int    ColId,
      Uint64 value
    )

Parameters.  This method takes two parameters, listed here:

  • The ID (ColId) of the column whose value is to be tested

  • An integer with which to compare the column value; this integer may be either 32-bit or 64-bit, and is unsigned in either case.

Return value.  Returns 0 on success, or -1 on failure.

2.3.27.2.6 NdbScanFilter::isfalse()

Description.  Defines a term of the current group as FALSE.

Signature. 

int isfalse
    (
      void
    )

Parameters.  None.

Return value.  0 on success, or -1 on failure.

2.3.27.2.7 NdbScanFilter::isnotnull()

Description.  This method is used to check whether a column value is not NULL.

Signature. 

int isnotnull
    (
      int ColId
    )

Parameters.  The ID of the column whose value is to be tested.

Return value.  Returns 0, if the column value is not NULL.

2.3.27.2.8 NdbScanFilter::isnull()

Description.  This method is used to check whether a column value is NULL.

Signature. 

int isnull
    (
      int ColId
    )

Parameters.  The ID of the column whose value is to be tested.

Return value.  Returns 0, if the column value is NULL.

2.3.27.2.9 NdbScanFilter::istrue()

Description.  Defines a term of the current group as TRUE.

Signature. 

int istrue
    (
      void
    )

Parameters.  None.

Return value.  Returns 0 on success, -1 on failure.

2.3.27.2.10 NdbScanFilter::ge()

Description.  This method is used to perform a greater-than-or-equal test on a column value and an integer.

Signature.  This method accepts both 32-bit and 64-bit values, as shown here:

int ge
    (
      int    ColId,
      Uint32 value
    )


int ge
    (
      int    ColId,
      Uint64 value
    )

Parameters.  Like eq(), lt(), le(), and the other NdbScanFilter methods of this type, this method takes two parameters:

  • The ID (ColId) of the column whose value is to be tested

  • An integer with which to compare the column value; this integer may be either 32-bit or 64-bit, and is unsigned in either case.

Return value.  0 on success; -1 on failure.

2.3.27.2.11 NdbScanFilter::getNdbError()

Description.  Because errors encountered when building an NdbScanFilter do not propagate to any involved NdbOperation object, it is necessary to use this method to access error information.

Signature. 

const NdbError& getNdbError
    (
      void
    )

Parameters.  None.

Return value.  A reference to an NdbError.

2.3.27.2.12 NdbScanFilter::getNdbOperation()

Description.  If the NdbScanFilter was constructed with an NdbOperation, this method can be used to obtain a pointer to that NdbOperation object.

Signature. 

NdbOperation* getNdbOperation
    (
      void
    )

Parameters.  None.

Return value.  A pointer to the NdbOperation associated with this NdbScanFilter, if there is one. Otherwise, NULL.

2.3.27.2.13 NdbScanFilter::gt()

Description.  This method is used to perform a greater-than (strict upper bound) test on a column value and an integer.

Signature.  This method accommodates both 32-bit and 64-bit values:

int gt
    (
      int    ColId,
      Uint32 value
    )


int gt
    (
      int    ColId,
      Uint64 value
    )

Parameters.  Like the other NdbScanFilter methods of this type, this method takes two parameters:

  • The ID (ColId) of the column whose value is to be tested

  • An integer with which to compare the column value; this integer may be either 32-bit or 64-bit, and is unsigned in either case.

Return value.  0 on success; -1 on failure.

2.3.27.2.14 NdbScanFilter::le()

Description.  This method is used to perform a less-than-or-equal test on a column value and an integer.

Signature.  This method has two variants, to accommodate 32-bit and 64-bit values:

int le
    (
      int    ColId,
      Uint32 value
    )


int le
    (
      int    ColId,
      Uint64 value
    )

Parameters.  Like the other NdbScanFilter methods of this type, this method takes two parameters:

  • The ID (ColId) of the column whose value is to be tested

  • An integer with which to compare the column value; this integer may be either 32-bit or 64-bit, and is unsigned in either case.

Return value.  Returns 0 on success, or -1 on failure.

2.3.27.2.15 NdbScanFilter::lt()

Description.  This method is used to perform a less-than (strict lower bound) test on a column value and an integer.

Signature.  This method has 32-bit and 64-bit variants, as shown here:

int lt
    (
      int    ColId,
      Uint32 value
    )

int lt
    (
      int    ColId,
      Uint64 value
    )

Parameters.  Like eq(), ne(), and the other NdbScanFilter methods of this type, this method takes two parameters, listed here:

  • The ID (ColId) of the column whose value is to be tested

  • An integer with which to compare the column value; this integer may be either 32-bit or 64-bit, and is unsigned in either case.

Return value.  Retrturns 0 on success, or -1 on failure.

2.3.27.2.16 NdbScanFilter::ne()

Description.  This method is used to perform an inequality test on a column value and an integer.

Signature.  This method has 32-bit and 64-bit variants, as shown here:

int ne
    (
      int    ColId,
      Uint32 value
    )

int ne
    (
      int    ColId,
      Uint64 value
    )

Parameters.  Like eq() and the other NdbScanFilter methods of this type, this method takes two parameters:

  • The ID (ColId) of the column whose value is to be tested

  • An integer with which to compare the column value; this integer may be either 32-bit or 64-bit, and is unsigned in either case.

Return value.  Returns 0 on success, or -1 on failure.