Library Version 12.1.6.0

Dbc::cmp()
Prev | Chapter 3. The Dbc Handle | Next

## Dbc::cmp()

    #include <db_cxx.h>

    int
    Dbc::cmp(Dbc *other_cursor, int *result, u_int32_t flags);

The `Dbc::cmp()` method compares two cursors for equality. Two cursors are equal if and only if they are positioned on the same item in the same database.

The `Dbc::cmp()` method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.

### Parameters

#### other_cursor

The other_cursor parameter references another cursor handle that will be used as the comparator.

#### result

If the call is successful and both cursors are positioned on the same item, result is set to zero. If the call is successful but the cursors are not positioned on the same item, result is set to a non-zero value. If the call is unsuccessful, the value of result should be ignored.

#### flags

The flags parameter is currently unused, and must be set to 0.

### Errors

The `Dbc::cmp()` method may fail and throw a DbException exception, encapsulating one of the following non-zero errors, or return one of the following non-zero errors:

#### EINVAL

- If either of the cursors are already closed.

- If the cursors have been opened against different databases.

- If either of the cursors have not been positioned.

- If the other_dbc parameter is NULL.

- If the result parameter is NULL.

### Class

Dbc

### See Also

Database Cursors and Related Methods

Prev | Up | Next
Dbc::close() | Home | Dbc::count()