KI_REWRITE

Overwrite an existing row

Synopsis:
CALL KI_REWRITE handle, rowid$, SYM(rowbuf$), [eLockType] TO status
status = 'ki_rewrite( handle, rowid$, SYM(rowbuf$), [eLockType] )
ArgumentEnumerationPurpose
handleHandle
rowid$Row ID as returned from a previous operation
SYM(rowbuf$)Symbol of row buffer
eLockTypeKCML_KDB_LOCK_ENUMOptional lock type
statusKDB_ERROR_ENUMReturn status
>KI_REWRITE

KI_REWRITE

This routine rewrites the row buffer in place of the previously held row at pointer position, unlocks it and updates the index if any key has changed. The row must already have been previously locked in a KI_READ_HOLD, KI_READ_HOLD_NEXT or KI_READ_HOLD_PTR operation in order to lock it and discover its rowid via ki_dataptr$. The separate KI_WRITE call is used to create new rows.

Because the rowid from the KI_READ_HOLD must be supplied, it is possible to hold more than one row at any time and rewrite in any order.

If the lock flag eLockType is _KDB_LOCK then the row will be rewritten and left locked. If omitted, or set to _KDB_NOLOCK, then it will be unlocked. In SQL databases transactional locks remain held until the transaction COMMIT or ROLLBACK

If an implicit transaction was started by taking a lock on a row with KI_READ_HOLD the implicit transaction will be committed when that row is updated with KI_REWRITE.

A rewrite of a row with a long term lock will free the long term lock. If done inside a transaction then the unlock will take place when the transaction is committed.

If lock tracking is enabled on the connection then it will be an error to rewrite a row that was not previously held.

If the call fails, then the index is not modified.

History
Introduced in KCML 3.00
See Also:
KI_BUILD, KI_COPY_TABLE, KI_CREATE, KI_CREATE_TMP, KI_DELETE, KI_DELETE_ROWS, KI_DELETE_WHERE, KI_END, KI_ERROR, KI_ERROR_TEXT, KI_FETCH, KI_GET_ERROR_TEXT, KI_GET_SERIAL, KI_GROW, KI_INFO, KI_INITIALISE, KI_LOCK_ALL, KI_LOCK_OWNER, KI_MOVE_ROWS, KI_MOVE_TABLE, KI_OPEN, KI_READ, KI_READ_ARRAY, KI_READ_HOLD, KI_READ_HOLD_NEXT, KI_READ_HOLD_PTR, KI_READ_NEXT, KI_READ_PTR, KI_READ_RANDOM, KI_READ_RAW, KI_REBUILD, KI_SET_EXTENT, KI_SET_ROWS, KI_SET_SERIAL, KI_SET_WLOCK_COUNT, KI_SIZE_FILE, KI_START, KI_START_BEG, KI_START_BETWEEN, KI_START_FIRST, KI_START_ON, KI_START_ROW, KI_START_ROW_BETWEEN, KI_UNLOCK, KI_UNLOCK_FILE, KI_VERIFY, KI_WMODE_BITMAP, KI_WRITE, KI_WRITE_PTR, KI_WRITE_RAW, KI_WS_CREATE, KI_WS_DELETE, KI_WS_OPEN, KI_WS_READ, KI_WS_REWRITE, KI_WS_WRITE
KCML database status codes