Documentation Home
MySQL NDB Cluster API Developer Guide
Download this Manual

2.3.25.3 NdbOperation::equal()

Description.  This method defines a search condition with an equality. The condition is true if the attribute has the given value. To set search conditions on multiple attributes, use several calls to equal(); in such cases all of them must be satisfied for the tuple to be selected.

Important

If the attribute is of a fixed size, its value must include all bytes. In particular a Char value must be native-space padded. If the attribute is of variable size, its value must start with 1 or 2 little-endian length bytes (2 if its type is Long*).

Note

When using insertTuple(), you may also define the search key with setValue(). See Section 2.3.25.17, “NdbOperation::setValue()”.

Signature.  There are 10 versions of equal(), each having slightly different parameters. All of these are listed here:

int  equal
    (
      const char* name,
      const char* value
    )

int  equal
    (
      const char* name,
      Int32       value
    )

int  equal
    (
      const char* name,
      Uint32      value
    )

int  equal
    (
      const char* name,
      Int64       value
    )

int  equal
    (
      const char* name,
      Uint64      value
    )

int  equal
    (
      Uint32      id,
      const char* value
    )

int  equal
    (
      Uint32 id,
      Int32  value
    )

int  equal
    (
      Uint32 id,
      Uint32 value
    )

int  equal
    (
      Uint32 id,
      Int64  value
    )

int  equal
    (
      Uint32 id,
      Uint64 value
    )

Parameters.  This method requires two parameters:

  • The first parameter can be either of the following:

    1. The name of the attribute (a string)

    2. The id of the attribute (an unsigned 32-bit integer)

  • The second parameter is the attribute value to be tested. This value can be any one of the following 5 types:

    1. String

    2. 32-bit integer

    3. Unsigned 32-bit integer

    4. 64-bit integer

    5. Unsigned 64-bit integer

Return value.  Returns -1 in the event of an error.