KI_READ_RAW
Argument | Enumeration | Purpose |
---|---|---|
handle | Handle | |
rowid | Initial row number | |
rowsin | Number of rows to read | |
SYM(rowbuf$) | Symbol of row buffer | |
status | KDB_ERROR_ENUM | Return status |
rowsout | Number of rows actually read | |
SYM(rowidbuf$) | Symbol of rowid buffer (Type 7 tables only) |
KI_READ_RAW
This function can be used to perform a non-indexed table scan of a table in the most efficient manner. It fills the buffer with up to rowsin rows starting at the given row counter rowid. To start the scan you must set rowid to 1. If you request more rows than will fit into the buffer, or more than are available, then rowsout is truncated to the number of rows that will fit. If the buffer is larger than required, then the extra bytes are unaltered. The actual number of rows read is returned in rowsout. This should be added to rowid for the next fetch. Note that you must proceed sequentially down the table. For portability between databases it is not possible to jump around by setting rowid to arbitrary values.
Both active and deleted rows will be returned and it is the programmer's responsibility to ignore deleted rows where byte one is HEX(FF).
For KDB type 7 tables and SQL database tables the requirement to start at rowid set to 1 and proceed sequentially down the table is STRICTLY enforced. It is also important to note that rowid in this context is used purely as a counter and is in no way related to the rowid$ used in other function calls. Deleted rows are no longer returned in the buffer. The optional parameter rowidbuf$ may be used to return the rowid's of the rows returned, this buffer must allow at least 6 bytes for each row expected (18 bytes if connected to an Oracle database) to be returned, if the buffer is not big enough the number of rows returned will be truncated. If rowidbuf$ is an array then one rowid is returned per element of that array, as long as the element size is big enough to hold a rowid, if the element is not large enough a KE_BADBUFFER_ error will be returned.