db_find_key
Definition: | integer i = db_find_key(object key) |
Description: | Find the record in the current table with the specified key. If found, the record number will be returned. If not found, the record number that key would occupy, if inserted, is returned as a negative number. |
pwa/p2js: | Not supported |
Comments: | A fast binary search is used to find the key in the
current table. The number of comparisons is proportional
to the log of the number of records in the table.
You can select a range of records by searching for the first and last key values in the range. If those key values do not exist you will get a negative value showing where they would be if they existed. |
Example: |
rec_num = db_find_key("Millennium") if rec_num > 0 then ? db_record_key(rec_num) ? db_record_data(rec_num) else puts(2, "Not found, but if you insert it,\n") puts(2, "it will be #%d\n", -rec_num) end if |
See Also: | db_record_key, db_record_data, db_insert |