From 06b6f5444782e11780cf626c622c73d34788a2a7 Mon Sep 17 00:00:00 2001 From: marko <> Date: Wed, 19 Sep 2007 07:11:13 +0000 Subject: [PATCH] branches/zip: row_ext_lookup_ith(): New function, sliced from row_ext_lookup(). --- include/row0ext.h | 14 ++++++++++++++ include/row0ext.ic | 41 ++++++++++++++++++++++++++++++++--------- 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/include/row0ext.h b/include/row0ext.h index 1c545da7616..98d996be83e 100644 --- a/include/row0ext.h +++ b/include/row0ext.h @@ -29,6 +29,20 @@ row_ext_create( Looks up a column prefix of an externally stored column. */ UNIV_INLINE byte* +row_ext_lookup_ith( +/*===============*/ + /* out: column prefix, or NULL if + the column is not stored externally */ + row_ext_t* ext, /* in/out: column prefix cache */ + ulint i, /* in: ith element of ext */ + const byte* field, /* in: locally stored part of the column */ + ulint f_len, /* in: length of field, in bytes */ + ulint* len); /* out: length of prefix, in bytes, + at most REC_MAX_INDEX_COL_LEN */ +/************************************************************************ +Looks up a column prefix of an externally stored column. */ +UNIV_INLINE +byte* row_ext_lookup( /*===========*/ /* out: column prefix, or NULL if diff --git a/include/row0ext.ic b/include/row0ext.ic index bdd5557a2b6..253cfc83d7c 100644 --- a/include/row0ext.ic +++ b/include/row0ext.ic @@ -50,6 +50,37 @@ row_ext_create( return(ret); } +/************************************************************************ +Looks up a column prefix of an externally stored column. */ +UNIV_INLINE +byte* +row_ext_lookup_ith( +/*===============*/ + /* out: column prefix, or NULL if + the column is not stored externally */ + row_ext_t* ext, /* in/out: column prefix cache */ + ulint i, /* in: index of ext->ext[] */ + const byte* field, /* in: locally stored part of the column */ + ulint f_len, /* in: length of field, in bytes */ + ulint* len) /* out: length of prefix, in bytes, + at most REC_MAX_INDEX_COL_LEN */ +{ + ut_ad(ext); + ut_ad(field); + ut_ad(len); + ut_ad(i < ext->n_ext); + + /* Return from the cache if found */ + if (ext->len[i]) { + *len = ext->len[i]; + ut_ad(*len > f_len); + return(ext->buf + i * REC_MAX_INDEX_COL_LEN); + } + + /* Update the cache */ + return(row_ext_lookup_low(ext, i, field, f_len, len)); +} + /************************************************************************ Looks up a column prefix of an externally stored column. */ UNIV_INLINE @@ -73,15 +104,7 @@ row_ext_lookup( for (i = 0; i < ext->n_ext; i++) { if (col == ext->ext[i]) { - /* Return from the cache if found */ - if (ext->len[i]) { - *len = ext->len[i]; - ut_ad(*len > f_len); - return(ext->buf + i * REC_MAX_INDEX_COL_LEN); - } - - /* Update the cache */ - return(row_ext_lookup_low(ext, i, field, f_len, len)); + return(row_ext_lookup_ith(ext, i, field, f_len, len)); } }