This method is used to define a comparison between a given value
and the value of a column. Beginning with NDB 8.0.18, it can
also be used to compare two columns. (This method does not
actually execute the comparison, which is done later when
performing the scan for which this
NdbScanFilter is defined.)
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.
NdbScanFilter Integer Comparison Methods.
int cmp ( BinaryCondition condition, int columnId, const void* value, Uint32 length = 0 )
Addtionally, in NDB 8.0.18 and later:
int cmp ( BinaryCondition condition, int ColumnId1, int ColumnId2 )
Parameters. When used to compare a value with a column, 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
columnIDwith some arbitrary value. The
BinaryConditionvalue; for permitted values and the relations that they represent, see Section 22.214.171.124, “NdbScanFilter::BinaryCondition”.
COND_NOTLIKEare used to compare a column value with a string pattern.
columnId: This is the column's identifier, which can be obtained using the
value: The value to be compared, repesented as a pointer to
When using a
COND_NOTLIKEcomparison condition, the
valueis treated as a string pattern. This string must not be padded or use a prefix. The string
valuecan include the pattern metacharacters or “wildcard” characters
_, which have the meanings shown here:
Table 2.60 Pattern metacharacters used with COND_LIKE and COND_NOTLIKE comparisons
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
These are the same wildcard characters that are supported by the SQL
NOT LIKEoperators, and are interpreted in the same way. See String Comparison Functions and Operators, for more information.
length: The length of the value to be compared. The default value is
lengthhas the same effect as comparing to
NULL, that is using the
When used to compare two columns,
the following parameters:
condition: The condition to be tested when comparing the columns. The condition may be any one of the
GE. Other values are not accepted.
columnID1: ID of the first of the two columns to be compared.
columnID1: ID of the second column.
Columns being compared using this method must be of exactly the same type. This includes length, precision, scale, and all other particulars.
This method returns an integer:
0 on success,
-1 on failure.