Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- C/Database Toolchest Library - name: <b>imodrec</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Name:       imodrec

Purpose:    modify an existing record in the database

Prototype:  int imodrec(Db_Obj    *db,
                        Index_Obj *index,
                        char      *new_fields[]);

Header:     isam.h

Inputs:     db          - database handle
            index       - index handle
            new_fields  - array of pointer to fields which contain new
                              values.

Description:
        imodrec replaces the current record in the index of the
        database db with the new record specified in new_fields.  All
        indexes of the database are automatically updated to know that the
        record was modified.

        The new_fields array contains the new values for the current
        record.  Each element of the array is a pointer to the field value for
        the corresponding field.  Every field for the record must be included
        in the array, even fields that not changing.  Each field value is a
        string of arbitrary bytes (usually text) terminated by a binary zero
        byte.  The list of field pointers need not be terminated by a NULL
        pointer, but it won't hurt.

        imodrec behaves just as if you had called idelrec followed by
        iaddrec, with one exception: imodrec attempts to do the modify
        in place if possible.  Notice in particular, that the file cursor
        (current record pointer) is moved to the record following the original
        version of the record (just as when you call idelrec).  The
        in-place modification makes imodrec possibly more efficient than
        calling the idelrec/iaddrec combination.

        If the original record was the current record or the marked record of
        any index (including the one specified as an argument), the file
        cursor or mark is moved to the record following the original record.

Returns:
        OK or ERROR

See Also: iaddrec idelrec

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson