mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge 10.6 into 10.7
This commit is contained in:
22
sql/table.cc
22
sql/table.cc
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2021, MariaDB
|
||||
Copyright (c) 2008, 2022, MariaDB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -1780,6 +1780,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
||||
Field_data_type_info_array field_data_type_info_array;
|
||||
MEM_ROOT *old_root= thd->mem_root;
|
||||
Virtual_column_info **table_check_constraints;
|
||||
bool *interval_unescaped= NULL;
|
||||
extra2_fields extra2;
|
||||
bool extra_index_flags_present= FALSE;
|
||||
DBUG_ENTER("TABLE_SHARE::init_from_binary_frm_image");
|
||||
@@ -2242,6 +2243,13 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
||||
|
||||
goto err;
|
||||
|
||||
if (interval_count)
|
||||
{
|
||||
if (!(interval_unescaped= (bool*) my_alloca(interval_count * sizeof(bool))))
|
||||
goto err;
|
||||
bzero(interval_unescaped, interval_count * sizeof(bool));
|
||||
}
|
||||
|
||||
field_ptr= share->field;
|
||||
table_check_constraints= share->check_constraints;
|
||||
read_length=(uint) (share->fields * field_pack_length +
|
||||
@@ -2596,11 +2604,17 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
||||
if (share->mysql_version < 100200)
|
||||
attr.pack_flag&= ~FIELDFLAG_LONG_DECIMAL;
|
||||
|
||||
if (interval_nr && attr.charset->mbminlen > 1)
|
||||
if (interval_nr && attr.charset->mbminlen > 1 &&
|
||||
!interval_unescaped[interval_nr - 1])
|
||||
{
|
||||
/* Unescape UCS2 intervals from HEX notation */
|
||||
/*
|
||||
Unescape UCS2/UTF16/UTF32 intervals from HEX notation.
|
||||
Note, ENUM/SET columns with equal value list share a single
|
||||
copy of TYPELIB. Unescape every TYPELIB only once.
|
||||
*/
|
||||
TYPELIB *interval= share->intervals + interval_nr - 1;
|
||||
unhex_type2(interval);
|
||||
interval_unescaped[interval_nr - 1]= true;
|
||||
}
|
||||
|
||||
#ifndef TO_BE_DELETED_ON_PRODUCTION
|
||||
@@ -3348,6 +3362,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
||||
share->error= OPEN_FRM_OK;
|
||||
thd->status_var.opened_shares++;
|
||||
thd->mem_root= old_root;
|
||||
my_afree(interval_unescaped);
|
||||
DBUG_RETURN(0);
|
||||
|
||||
err:
|
||||
@@ -3375,6 +3390,7 @@ err:
|
||||
open_table_error(share, OPEN_FRM_CORRUPTED, share->open_errno);
|
||||
|
||||
thd->mem_root= old_root;
|
||||
my_afree(interval_unescaped);
|
||||
DBUG_RETURN(HA_ERR_NOT_A_TABLE);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user