Logo Search packages:      
Sourcecode: maxdb-7.5.00 version File versions  Download package

void cbd500_Tree::bd530AddRecordSpace ( tsp00_KeyPtr  pKey,
tsp00_Int4  KeyLen,
tsp00_Int4  RequiredRecLen,
tgg00_RecPtr &  pRec 
)

function: bd530AddRecordSpace description: This adds record space at a specified place.

POST: The PathInfo might be invalid. arguments: Key [in] specifies the Leaf RequiredLen [in] the record length pRec [out] points to a byte-string for the new record

**************************************************************************

module : vbd530.cpp responsible : UweH special area: cbd500_Tree last changed: 1999-08-04 14:29 see also : example.html ... copyright: (c) 1998-2004 SAP AG description : Methods for managing record-space

========== licence begin GPL Copyright (c) 1998-2005 SAP AG

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ========== licence end

Definition at line 92 of file vbd530.cpp.

References cbd300_InvCurrentBasis::bd300LockTreeExclusive(), cbd300_InvCurrentBasis::bd300RootRequestKind(), bd500FindNode(), bd520LeafOverflow(), cbd600_Node::bd600AddRecordSpace(), cbd600_Node::bd600RecPtr(), cbd600_Node::bd600Release(), cbd600_Node::bd600SearchRecord(), cbd600_Node::bd600SpaceIsAvailable(), cbd600_Node::m_Current, and void().

{
      ROUTINE_DBG_MEO00 ("bd530AddRecordSpace");

      tsp00_Int4       RecIndex;
      tbd_searchresult SearchResult;
      
      bd500FindNode (pKey, KeyLen, LEAF_LEVEL_BD00);
    if (m_TrError != e_ok) return;

      m_Node.bd600SearchRecord (pKey, KeyLen, RecIndex, SearchResult);
      if (m_TrError != e_ok) return;

      if ( thisfound == SearchResult )
      {
            m_TrError = e_duplicate_key;
            return;
      }

      /* check if the new record suits into current page */

      if ( ! m_Node.bd600SpaceIsAvailable(RequiredRecLen + POINTERSIZE_BD00) )
      {
            if ( m_Node.m_Current.bd300RootRequestKind() != nr_for_update )
            {
                  /* release current Leaf Node */
                  m_Node.bd600Release (! IS_CHANGED_BD600);

                  /* get exclusive tree lock  */
                  if ( m_Node.m_Current.bd300LockTreeExclusive() )
                if ( g01vtrace.vtrAll_gg00 || g01vtrace.vtrBdIndex_gg00 )
                    bd500_WriteTrace("bd530AddRecordSpace: Overflow",29);
                  if (m_TrError != e_ok) return;

                  /* search leaf again */
                  bd500FindNode (pKey, KeyLen, LEAF_LEVEL_BD00);
                  if (m_TrError != e_ok) return;

                  m_Node.bd600SearchRecord (pKey, KeyLen, RecIndex, SearchResult);
                  if (m_TrError != e_ok) return;

                  if ( thisfound == SearchResult )
                  {
                        m_TrError = e_duplicate_key;
                        return;
                  }
            }

            (void) bd520LeafOverflow (pKey, KeyLen, true, RequiredRecLen, RecIndex);
            if (m_TrError != e_ok) return;
      }

      pRec = m_Node.bd600RecPtr(RecIndex);

      m_Node.bd600AddRecordSpace (RequiredRecLen + POINTERSIZE_BD00, RecIndex, pRec);
}


Generated by  Doxygen 1.6.0   Back to index