DbiModifyRecord

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

DbiModifyRecord

Return to chapter overview

C syntax

DBIResult DBIFN DbiModifyRecord (hCursor, pRecBuf, bFreeLock);

Delphi syntax

function DbiModifyRecord (hCursor: hDBICur; pRecBuf: Pointer; bFreeLock: Bool): DBIResult stdcall;

Description

DbiModifyRecord modifies the current record of the table associated with hCursor with the data supplied in pRecBuf.

Parameters

hCursor                Type: hDBICur                (Input)
Specifies the cursor handle for the table. The cursor must be positioned on a valid record.

pRecBuf                Type: pBYTE                (Input)
Pointer to the client buffer where the modified record is stored.

bFreeLock                Type: BOOL                (Input)
Specifies whether to release locks on completion. If set to TRUE, the lock is released on the updated record when DbiModifyRecord completes. If set to FALSE, the lock is not released.

Usage

Paradox: Before the table is updated, any referential integrity requirements or validity checks in place are verified. If any fail, an error is returned and the operation is canceled.

SQL: Tables must be opened with write access. If the table has no unique index or server row ID (this includes views), DbiModifyRecord can be used to modify records if the server supports it. However, if you attempt to modify a record that has a duplicate, you will receive an error.

If the record is locked (using dbiREADLOCK or dbiWRITELOCK), and the user tries to modify the record after another user has deleted the record or changed the key value for the record, DbiModifyRecord returns a DBIERR_KEYORRECDELETED error.

Prerequisites

The cursor must be positioned on a record, not on a crack, beginning of file, or end of file. The user must have read-write access to the table. The record must not be locked by another session.

Completion state

The cursor is positioned on the updated record. An error is returned if there is no current record for the cursor. If the key has changed, DbiModifyRecord is equivalent to calling first DbiDeleteRecord then DbiInsertRecord. When a record is modified in a table that has an active index, the position of the modified record may change if the key value was modified.

If the client requests to keep a lock on a modified record, and the record flies outside a current range or filter condition, the function returns DBIERR_RECLOCKFAILED and the operation fails.

DbiResult

Meaning

DBIERR_NONE

The record was modified successfully.

DBIERR_KEYVIOL

The table has a unique index and the modified key value conflicts with another record's key value.

DBIERR_BOF/EOF

The cursor is not positioned on a valid record; it is positioned at the beginning or the end of the table.

DBIERR_FILELOCKED

The table is locked by another user.

DBIERR_INVALIDHNDL

The specified cursor handle is invalid or NULL.

DBIERR_INVALIDPARAM

The specified record buffer is NULL.

DBIERR_KEYORRECDELETED

The specified cursor is not positioned on a valid record.

DBIERR_FOREIEGNKEYERR

The target table is a detail table in a referential integrity link and the linking value cannot be found in the master table (Paradox only).

DBIERR_MINVALERR

The specified data is less than the required minimum value.

DBIERR_MAXVALERR

The specified data is greater than the required maximum value.

DBIERR_REQDERR

The field cannot be blank.

DBIERR_LOOKUPTABLEERR

The specified value cannot be located in the assigned lookup table.

DBIERR_NOTSUFFTABLERIGHTS

Insufficient table rights to update table.

DBIERR_TABLEREADONLY

The specified cursor is read-only.

DBIERR_RECLOCKFAILED

The record lock failed.

DBIERR_MULTIPLUNIQRECS

Attempt to modify a record that has a duplicate (SQL).

See also

DbiDeleteRecord, DbiInitRecord, DbiPutField, DbiGetNextRecord, DbiGetRecord, DbiGetField, DbiAppendRecord, DbiInsertRecord, DbiGetBlob, DbiPutBlob, DbiOpenBlob, DbiFreeBlob