YoushouldhavereceivedacopyoftheGNUGeneralPublicLicense alongwiththisprogram;ifnot,writetotheFreeSoftware
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
blength=share->blength; if (share->records+1 == blength)
blength+= blength;
lastpos=hp_find_hash(&keyinfo->block,share->records);
last_ptr=0;
/* Search after record with key */
key_pos= hp_mask(hp_rec_hashnr(keyinfo, record), blength, share->records + 1);
pos= hp_find_hash(&keyinfo->block, key_pos);
gpos = pos3 = 0;
while (pos->ptr_to_rec != recpos)
{ if (flag && !hp_rec_key_cmp(keyinfo, record, pos->ptr_to_rec))
last_ptr=pos; /* Previous same key */
gpos=pos; if (!(pos=pos->next_key))
{
DBUG_RETURN(my_errno=HA_ERR_CRASHED); /* This shouldn't happend */
}
}
/* Remove link to record */
if (flag)
{ /* Save for heap_rnext/heap_rprev */
info->current_hash_ptr=last_ptr;
info->current_ptr = last_ptr ? last_ptr->ptr_to_rec : 0;
DBUG_PRINT("info",("Corrected current_ptr to point at: %p",
info->current_ptr));
}
empty=pos; if (gpos)
gpos->next_key=pos->next_key; /* unlink current ptr */ elseif (pos->next_key)
{
empty=pos->next_key;
pos->ptr_to_rec= empty->ptr_to_rec;
pos->next_key= empty->next_key;
pos->hash_of_key= empty->hash_of_key;
} else
keyinfo->hash_buckets--;
if (empty == lastpos) /* deleted last hash key */
DBUG_RETURN (0);
/* Move the last key (lastpos) */
lastpos_hashnr= lastpos->hash_of_key; /* pos is where lastpos should be */
pos=hp_find_hash(&keyinfo->block, hp_mask(lastpos_hashnr, share->blength,
share->records)); if (pos == empty) /* Move to empty position. */
{
empty[0]=lastpos[0];
DBUG_RETURN(0);
}
pos_hashnr= pos->hash_of_key; /* pos3 is where the pos should be */
pos3= hp_find_hash(&keyinfo->block,
hp_mask(pos_hashnr, share->blength, share->records)); if (pos != pos3)
{ /* pos is on wrong posit */
empty[0]=pos[0]; /* Save it here */
pos[0]=lastpos[0]; /* This shold be here */
hp_movelink(pos, pos3, empty); /* Fix link to pos */
DBUG_RETURN(0);
}
pos2= hp_mask(lastpos_hashnr, blength, share->records + 1); if (pos2 == hp_mask(pos_hashnr, blength, share->records + 1))
{ /* lastpos and the row in the main bucket entry (pos) has the same hash */ if (pos2 != share->records)
{ /* Thebucketentrywasnotdeleted.Copylastposoverthe deletedentryandupdatepreviouslinktopointtoit.
*/
empty[0]= lastpos[0];
hp_movelink(lastpos, pos, empty); if (last_ptr == lastpos)
{ /* Wemovedtherowthatinfo->current_hash_ptrpointsto. Updateinfo->current_hash_ptrtopointtothenewposition.
*/
info->current_hash_ptr= empty;
}
DBUG_RETURN(0);
} /* Shrinkingthehashtabledeletedthemainbucketentryforthishash. Inthiscasethelastentrywasthefirstkeyinthekeychain. Wemovethingsaroundsothatwekeeptheoriginalkeyordertoensure thatheap_rnext()works. -Movetherowatthemainbucketentrytotheemptyspot. -Movethelastentryfirstinthenewchain. -Linkinthefirstelementofthehash.
*/
empty[0]= pos[0];
pos[0]= lastpos[0];
hp_movelink(pos, pos, empty);
/* Update current_hash_ptr if the entry moved */ if (last_ptr == lastpos)
info->current_hash_ptr= pos; elseif (last_ptr == pos)
info->current_hash_ptr= empty;
DBUG_RETURN(0);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.