YoushouldhavereceivedacopyoftheGNUGeneralPublicLicense alongwiththisprogram;ifnot,writetotheFreeSoftware
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
/* Read record based on a key */
#include"myisamdef.h" #include"rt_index.h"
/* Read a record using key */ /* Ordinary search_flag is 0 ; Give error if no record with key */
if (info->once_flags & USE_PACKED_KEYS)
{
info->once_flags&= ~USE_PACKED_KEYS; /* Reset flag */ /* keyisalreadypacked!;ThishappenswhenweareusingaMERGETABLE Inthiskey'key_part_map'isthelengthofthekey!
*/
key_buff=info->lastkey+info->s->base.max_key_length;
pack_key_length= keypart_map;
bmove(key_buff, key, pack_key_length);
last_used_keyseg= info->s->keyinfo[inx].seg + info->last_used_keyseg;
} else
{
DBUG_ASSERT(keypart_map); /* Save the packed key for later use in the second buffer of lastkey. */
key_buff=info->lastkey+info->s->base.max_key_length;
pack_key_length=_mi_pack_key(info,(uint) inx, key_buff, (uchar*) key,
keypart_map, &last_used_keyseg); /* Save packed_key_length for use by the MERGE engine. */
info->pack_key_length= pack_key_length;
info->last_used_keyseg= (uint16) (last_used_keyseg -
info->s->keyinfo[inx].seg);
DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE, keyinfo->seg,
key_buff, pack_key_length););
}
if (fast_mi_readinfo(info)) goto err;
if (share->concurrent_insert)
mysql_rwlock_rdlock(&share->key_root_lock[inx]);
if (info->lastpos == HA_OFFSET_ERROR) /* No such record */
{
fast_mi_writeinfo(info); if (!buf)
DBUG_RETURN(my_errno);
} else
{ /* Calculate length of the found key; Used by mi_rnext_same */ if ((keyinfo->flag & HA_VAR_LENGTH_KEY) && last_used_keyseg)
info->last_rkey_length= _mi_keylength_part(keyinfo, info->lastkey,
last_used_keyseg);
/* Check if we don't want to have record back, only error message */ if (!buf)
{
fast_mi_writeinfo(info);
DBUG_RETURN(0);
} if (!(*info->read_record)(info,info->lastpos,buf))
{
info->update|= HA_STATE_AKTIV; /* Record is read */
DBUG_RETURN(0);
}
DBUG_PRINT("error", ("Didn't find row. Error %d", my_errno));
info->lastpos= HA_OFFSET_ERROR; /* Didn't find row */
}
/* Store last used key as a base for read next */
memcpy(info->lastkey,key_buff,pack_key_length);
info->last_rkey_length= pack_key_length;
bzero((char*) info->lastkey+pack_key_length,info->s->base.rec_reflength);
info->lastkey_length=pack_key_length+info->s->base.rec_reflength;
if (search_flag == HA_READ_AFTER_KEY)
info->update|=HA_STATE_NEXT_FOUND; /* Previous gives last row */
err:
DBUG_RETURN(my_errno);
} /* _mi_rkey */
my_bool mi_yield_and_check_if_killed(MI_INFO *info, int inx)
{
MYISAM_SHARE *share; if (mi_killed(info))
{ /* purecov: begin tested */
info->lastpos= HA_OFFSET_ERROR; /* Set error that we where aborted by kill from application */
my_errno= HA_ERR_ABORTED_BY_USER; return1; /* purecov: end */
}
if ((share= info->s)->concurrent_insert)
{ /* Give writers a chance to access index */
mysql_rwlock_unlock(&share->key_root_lock[inx]);
mysql_rwlock_rdlock(&share->key_root_lock[inx]);
} return0;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-10-08)
¤
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.