KI_DEFAULT_ROW
Argument | Enumeration | Purpose |
---|---|---|
handle | Open handle | |
SYM(newBuf$) | Symbol of new row buffer, or 0 | |
SYM(oldBuf$) | Symbol of old row buffer, or 0 | |
status | KDB_ERROR_ENUM | Return status |
KI_DEFAULT_ROW
When a table is created with a CREATE TABLE statement a default row is defined by any DEFAULT clauses attached to any of the columns. In the absence of such explicit defaults it is presumed that VARCHAR columns will be blank and numeric columns will be zero. The default row for an open table can be extracted at any time using this function thus:
CALL KI_DEFAULT_ROW handle, 0, SYM(rowbuf$) TO status
The buffer must be big enough to hold the row. The call will fail if the table does not have a default row already i.e. it was not created with CREATE TABLE in KCML 6.00 or later.
The retrieved row could then be changed by the program to reflect some new default and saved back into the table with:
CALL KI_DEFAULT_ROW handle, SYM(rowbuf$), 0 TO status
This call can also be used to add a default row to an existing table (type 6 or type 7 only) that did not have one. Changes to the default row done this way will not alter the DEFAULT clauses of the embedded schema which continues to reflect the CREATE TABLE statement used to create the table.
It is also possible, though less useful, to update the initial row and get a copy of the previous row with:
CALL KI_DEFAULT_ROW handle, SYM(oldrowbuf$), SYM(newrowbuf$) TO status