KI_START_ON

Start equals

Synopsis:
CALL KI_START_ON handle, keys$, path, [nCols], [max_rows], [bSkipMatch], [sql] TO status
'ki_start_on( handle, keys$, path, [nCols], [max_rows], [bSkipMatch], [sql], status )
ArgumentEnumerationPurpose
handleTable handle
keys$Compound row key
pathKey path
nColsNumber of significant columns in a compound key
max_rowsMax rows to return
bSkipMatchSkip matching row
sqlSQL Where Handle
statusKDB_ERROR_ENUMReturn status
>KI_START_ON

KI_START_ON

This function is very similar to KI_START with the difference that it requires the specified number of leading key columns nCols in a compound key to exactly match for a row to be included in the result set.

This type of operation is often used in simulating a join operation between two tables. A secondary table may have a compound key composed of two columns, the first of which is the primary key of the main table and the second of which is a unique identifier. KI_START_ON is intended to be used to filter out a result set where all the rows have the same primary key.

When used against an SQL database table on an index with a compound key KI_START_ON has significant performance advantages over the open ended KI_START and by providing this alternative rowset based code can be optimized for both native KDB and SQL without resorting to platform specific SQL.

If the column count nCols is zero then all the key columns must exactly match. If non-zero then the first nCols segments in the index key must match exactly and the remaining segments are ignored.

If the optional bSkipMatch flag is set to TRUE then the first rows in the result set are not returned if they match the supplied key. For positive path values a subsequent KI_READ_NEXT will read the first row with a key greater than the supplied key. For negative path values a subsequent KI_READ_NEXT a subsequent KI_READ_NEXT on the same negative path will read the last row with a key less than the supplied key.

Compatibility

As of KCML 6.60, all the functionality of KI_START_ON is available in KI_START and KI_START_ROW by setting the bClosed argument to TRUE. KI_START_ROW is to be preferred in new applications as the use of a row buffer allows KCML to specify the number of columns required which has performance advantages in 2-tier SQL databases.

History
Introduced in KCML 5.03
See Also:
KI_BUILD, KI_DELETE, KI_DELETE_ROWS, KI_DELETE_WHERE, KI_END, KI_ERROR, KI_ERROR_TEXT, KI_FETCH, KI_GET_ERROR_TEXT, KI_LOCK_OWNER, KI_MOVE_ROWS, 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_REWRITE, KI_SET_ROWS, KI_START, KI_START_BEG, KI_START_BETWEEN, KI_START_FIRST, KI_START_ROW, KI_START_ROW_BETWEEN, KI_UNLOCK, KI_WRITE, KI_WRITE_PTR, KI_WRITE_RAW
KCML database status codes