2N/A * Copyright (c) 1990, 1993, 1994 2N/A * The Regents of the University of California. All rights reserved. 2N/A * This code is derived from software contributed to Berkeley by 2N/A * Redistribution and use in source and binary forms, with or without 2N/A * modification, are permitted provided that the following conditions 2N/A * 1. Redistributions of source code must retain the above copyright 2N/A * notice, this list of conditions and the following disclaimer. 2N/A * 2. Redistributions in binary form must reproduce the above copyright 2N/A * notice, this list of conditions and the following disclaimer in the 2N/A * documentation and/or other materials provided with the distribution. 2N/A * 3. All advertising materials mentioning features or use of this software 2N/A * must display the following acknowledgement: 2N/A * This product includes software developed by the University of 2N/A * California, Berkeley and its contributors. 2N/A * 4. Neither the name of the University nor the names of its contributors 2N/A * may be used to endorse or promote products derived from this software 2N/A * without specific prior written permission. 2N/A * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2N/A * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2N/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2N/A * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2N/A * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2N/A * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2N/A * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2N/A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2N/A * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2N/A * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2N/A#
endif /* LIBC_SCCS and not lint */ 2N/A * __BT_PUT -- Add a btree item to the tree. 2N/A * dbp: pointer to access method 2N/A * flag: R_NOOVERWRITE 2N/A * RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key is already in the 2N/A * tree and R_NOOVERWRITE specified. 2N/A /* Toss any page pinned across calls. */ 2N/A /* Check for change to a read-only tree. */ 2N/A * If flags is R_CURSOR, put the cursor. Must already 2N/A * have started a scan and not have already deleted it. 2N/A * If the key/data pair won't fit on a page, store it on overflow 2N/A * pages. Only put the key on the overflow page if the pair are 2N/A * still too big after moving the data to an overflow page. 2N/A * If the insert fails later on, the overflow pages aren't recovered. 2N/A /* Replace the cursor. */ 2N/A * Find the key to delete, or, the location at which to insert. 2N/A * Bt_fast and __bt_search both pin the returned page. 2N/A * Add the key/data pair to the tree. If an identical key is already 2N/A * in the tree, and R_NOOVERWRITE is set, an error is returned. If 2N/A * R_NOOVERWRITE is not set, the key is either added (if duplicates are 2N/A * permitted) or an error is returned. 2N/A * Note, the delete may empty the page, so we need to put a 2N/A * new entry into the page immediately. 2N/A * If not enough room, or the user has put a ceiling on the number of 2N/A * keys permitted in the page, split the page. The split code will 2N/A * insert the key and data and unpin the current page. If inserting 2N/A * into the offset array, shift the pointers up. 2N/A /* If the cursor is on this page, adjust it as necessary. */ 2N/A * BT_FAST -- Do a quick check for sorted data. 2N/A * key: key to insert 2N/A * EPG for new record or NULL if not found. 2N/A * If won't fit in this page or have too many keys in this page, 2N/A * have to search to get split stack.