From ba06ffb33d1a1f160e934ac49400ad4651f6b3de Mon Sep 17 00:00:00 2001 From: inaam Date: Wed, 18 Jun 2008 22:20:53 +0000 Subject: [PATCH] branches/zip: fixes issue# 36 Fixed the issue where an unchanged blob column that is part of the primary key as well is lost if it is externally stored. The fix is provided by Marko. Reviewed by: Sunny --- mysql-test/innodb-zip.result | 18 ++++++++++++++++++ mysql-test/innodb-zip.test | 25 +++++++++++++++++++++++++ row/row0row.c | 30 +++++++++++++----------------- 3 files changed, 56 insertions(+), 17 deletions(-) diff --git a/mysql-test/innodb-zip.result b/mysql-test/innodb-zip.result index 634f77ddfec..22621eb9383 100644 --- a/mysql-test/innodb-zip.result +++ b/mysql-test/innodb-zip.result @@ -131,6 +131,24 @@ INSERT INTO t1 VALUES( 'FOXajs|.7@IR[dmv(2HR\fpz-7AKU_is}0:DNXblv)3=GQ[eoy,6@JT^hr|/9CMWaku(3>IT_ju)4?JU`kv*5@KValw+6ALWbmx,7BMXcny-8CNYdoz.9DOZep{/:EP[fq|0;FQ\gr}1KXer(6DR`n|3AO]ky0>LZhv-;IWes*8FTbp~5CQ_m{2@N\jx/=KYgu,:HVdr)7ESao}4BP^lz1?M[iw.N^n~7GWgw0@P`p)9IYiy2BRbr+;K[k{4DTdt-=M]m}6FVfv/?O_o(9J[l}7HYj{5FWhy3DUfw1BSdu/@Qbs->O`q+HR\fpz-7AKU_is}0:DNXblv)3=GQ[eoy,6@JT^hr|/9CMWaku(3>IT_ju)4?JU`kv*5@KValw+6ALWbmx,7BMXcny-8CNYdoz.9DOZep{/:EP[fq|0;FQ\gr}1KXer(6DR`n|3AO]ky0>LZhv-;IWes*8FTbp~5CQ_m{2@N\jx/=KYgu,:HVdr)7ESao}4BP^lz1?M[iw.N^n~7GWgw0@P`p)9IYiy2BRbr+;K[k{4DTdt-=M]m}6FVfv/?O_o(9J[l}7HYj{5FWhy3DUfw1BSdu/@Qbs->O`q+prefix_len == 0) { + continue; + } + + /* If a column prefix index, take only the prefix. + Prefix-indexed columns may be externally stored. */ + ut_ad(col->ord_part); + + if (UNIV_LIKELY_NULL(ext)) { /* See if the column is stored externally. */ const byte* buf = row_ext_lookup(ext, col_no, &len); @@ -139,15 +140,10 @@ row_build_index_entry( || dict_index_is_clust(index)); } - /* If a column prefix index, take only the prefix */ - if (ind_field->prefix_len > 0 && !dfield_is_null(dfield)) { - ut_ad(col->ord_part); - len = dtype_get_at_most_n_mbchars( - col->prtype, col->mbminlen, col->mbmaxlen, - ind_field->prefix_len, - len, dfield_get_data(dfield)); - dfield_set_len(dfield, len); - } + len = dtype_get_at_most_n_mbchars( + col->prtype, col->mbminlen, col->mbmaxlen, + ind_field->prefix_len, len, dfield_get_data(dfield)); + dfield_set_len(dfield, len); } ut_ad(dtuple_check_typed(entry));