mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 20:07:13 +02:00
Bug#52199 utf32: mbminlen=4, mbmaxlen=4, type->mbminlen=0, type->mbmaxlen=4
Merge and adjust a forgotten change to fix this bug. rb://393 approved by Jimmy Yang ------------------------------------------------------------------------ r3794 | marko | 2009-01-07 14:14:53 +0000 (Wed, 07 Jan 2009) | 18 lines branches/6.0: Allow the minimum length of a multi-byte character to be up to 4 bytes. (Bug #35391) dtype_t, dict_col_t: Replace mbminlen:2, mbmaxlen:3 with mbminmaxlen:5. In this way, the 5 bits can hold two values of 0..4, and the storage size of the fields will not cross the 64-bit boundary. Encode the values as DATA_MBMAX * mbmaxlen + mbminlen. Define the auxiliary macros DB_MBMINLEN(mbminmaxlen), DB_MBMAXLEN(mbminmaxlen), and DB_MINMAXLEN(mbminlen, mbmaxlen). Try to trim and pad UTF-16 and UTF-32 with spaces as appropriate. Alexander Barkov suggested the use of cs->cset->fill(cs, buff, len, 0x20). ha_innobase::store_key_val_for_row() now does that, but the added function row_mysql_pad_col() does not, because it doesn't have the MySQL TABLE object. rb://49 approved by Heikki Tuuri ------------------------------------------------------------------------
This commit is contained in:
parent
8847387ecd
commit
142e8417dc
20 changed files with 364 additions and 185 deletions
|
|
@ -28,6 +28,46 @@ Created 1/8/1996 Heikki Tuuri
|
|||
#include "dict0load.h"
|
||||
#include "rem0types.h"
|
||||
|
||||
/*********************************************************************//**
|
||||
Gets the minimum number of bytes per character.
|
||||
@return minimum multi-byte char size, in bytes */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
dict_col_get_mbminlen(
|
||||
/*==================*/
|
||||
const dict_col_t* col) /*!< in: column */
|
||||
{
|
||||
return(DATA_MBMINLEN(col->mbminmaxlen));
|
||||
}
|
||||
/*********************************************************************//**
|
||||
Gets the maximum number of bytes per character.
|
||||
@return maximum multi-byte char size, in bytes */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
dict_col_get_mbmaxlen(
|
||||
/*==================*/
|
||||
const dict_col_t* col) /*!< in: column */
|
||||
{
|
||||
return(DATA_MBMAXLEN(col->mbminmaxlen));
|
||||
}
|
||||
/*********************************************************************//**
|
||||
Sets the minimum and maximum number of bytes per character. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
dict_col_set_mbminmaxlen(
|
||||
/*=====================*/
|
||||
dict_col_t* col, /*!< in/out: column */
|
||||
ulint mbminlen, /*!< in: minimum multi-byte
|
||||
character size, in bytes */
|
||||
ulint mbmaxlen) /*!< in: minimum multi-byte
|
||||
character size, in bytes */
|
||||
{
|
||||
ut_ad(mbminlen < DATA_MBMAX);
|
||||
ut_ad(mbmaxlen < DATA_MBMAX);
|
||||
ut_ad(mbminlen <= mbmaxlen);
|
||||
|
||||
col->mbminmaxlen = DATA_MBMINMAXLEN(mbminlen, mbmaxlen);
|
||||
}
|
||||
/*********************************************************************//**
|
||||
Gets the column data type. */
|
||||
UNIV_INLINE
|
||||
|
|
@ -42,8 +82,7 @@ dict_col_copy_type(
|
|||
type->mtype = col->mtype;
|
||||
type->prtype = col->prtype;
|
||||
type->len = col->len;
|
||||
type->mbminlen = col->mbminlen;
|
||||
type->mbmaxlen = col->mbmaxlen;
|
||||
type->mbminmaxlen = col->mbminmaxlen;
|
||||
}
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
|
||||
|
|
@ -65,8 +104,7 @@ dict_col_type_assert_equal(
|
|||
ut_ad(col->prtype == type->prtype);
|
||||
ut_ad(col->len == type->len);
|
||||
# ifndef UNIV_HOTBACKUP
|
||||
ut_ad(col->mbminlen == type->mbminlen);
|
||||
ut_ad(col->mbmaxlen == type->mbmaxlen);
|
||||
ut_ad(col->mbminmaxlen == type->mbminmaxlen);
|
||||
# endif /* !UNIV_HOTBACKUP */
|
||||
|
||||
return(TRUE);
|
||||
|
|
@ -84,7 +122,7 @@ dict_col_get_min_size(
|
|||
const dict_col_t* col) /*!< in: column */
|
||||
{
|
||||
return(dtype_get_min_size_low(col->mtype, col->prtype, col->len,
|
||||
col->mbminlen, col->mbmaxlen));
|
||||
col->mbminmaxlen));
|
||||
}
|
||||
/***********************************************************************//**
|
||||
Returns the maximum size of the column.
|
||||
|
|
@ -109,7 +147,7 @@ dict_col_get_fixed_size(
|
|||
ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */
|
||||
{
|
||||
return(dtype_get_fixed_size_low(col->mtype, col->prtype, col->len,
|
||||
col->mbminlen, col->mbmaxlen, comp));
|
||||
col->mbminmaxlen, comp));
|
||||
}
|
||||
/***********************************************************************//**
|
||||
Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a column.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue