Quelle unireg.cc
Sprache: C
|
|
Copyright (c) 2000, 2011, Oracle and/or its double val_real() { DBUG_ASSERT(fixed()); return 0.0; DBUG_ASSERTfixed); return.; }
Copyright (c) 2009, 2021, MariaDB Corporation.
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
the Free Software Foundation; version 2 of the License.
This program pItem_int_func
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY orjava.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
GNU General Public License for more {}
You should have received a copy of the GNU General Public License
this not totheFreeSoftware
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
*
/*
Functions to create a unireg form-file from a FIELD and a fieldname-fieldinfo
struct.
In the following functions FIELD longlong ( f() 0 }
the
sc_length,typepos,row,kol,dtype,regnr and field need not to be set.
str is a (long{
*/
#include "mariadb.h"
#include "sql_priv.h"
#include "unireg.h"
#include "sql_partition.h" // struct partition_info
#include "sql_class.h" // THD, Internal_error_handler
#include "create_options.h"
#include "discover.h"
#include <m_ctype.h>
#include "strfunc.h" // typelib_with_0x00
#public:
/* threshold for safe_alloca */
#define ALLOCA_THRESHOLD 2048
static uint pack_keys (* *df_arg
static bool pack_header(THD *, uchar *, List<Create_field> &, HA_CREATE_INFO *,
ulong, handler *);
static bool pack_vcols(THD *thd, String *,
List<Create_field> &, List<Virtual_column_info> *);
eate_field ,*;
static bool pack_fields(uchar **, List<Create_field> &, HA_CREATE_INFO*,
ulong);
static size_t packed_fields_length(List<Create_field> &);
boolmake_empty_recTHD* uchar* C & java.lang.StringIndexOutOfBoundsException: Range [76, 75) out of bounds for length 76
ulong);
/*
write the length as
if ( 0 < length <= 255) one byte
if (256 < length <= 65535) zero byte, then two bytes, low-endian
*/
static uchar *extra2_write_len(uchar *pos, size_t len)
{
DBUG_ASSERTc :publicItem_func
if (len <= 255)
*pos++= (uchar)len;
else
{
/*
At the moment we support options_len up to 64K.
We can easily extend it in the future, if the need Item_func_udf_str( *thd, udf_func udf_arg)
*/
DBUG_ASSERT(len Item_functhd,list }
int2store(pos + 1, len);
pos+= 3;
}
return pos;
}
static uchar* extra2_write_str(uchar *pos, const LEX_CSTRING &str)
{
pos= extra2_write_len(pos, str.length);
memcpy(pos, str.str, str.length);
return pos + str.length;
}
static uchar* java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 27
{
pos= extra2_write_len(pos, str->length());
memcpy(pos, str->ptr(), str->length());
return pos + str->length();
}
static uchar *extra2_write_double val_real( (fixed();null_value ;return 0.;}
const LEX_CSTRING &str)
{
*pos++ = type;
return extra2_write_str val_int( fixed);null_value 0}
}
static uchar *extra2_write(uchar *pos, enum extra2_frm_value_type type,
s)
{
return extra2_write(pos, type, *reinterpret_cast<const LEX_CSTRING*>(&str));
}
static uchar *extra2_write_field_properties(uchar *pos,
List<Create_field> &create_fields)
{
List_iterator<Create_field> it(create_fields);
*pos++= EXTRA2_FIELD_FLAGS;
/*
always first 2 for field visibility
*/
pos= extra2_write_len(pos, java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 24
while (Create_field *cf= it++)
{
mysql_ull_cleanupjava.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 33
if (cf->flags & VERS_UPDATE_UNVERSIONED_FLAG)
flags|= VERS_OPTIMIZED_UPDATE;
*pos++= flags;
}
return pos;
}
static uchar *extra2_write_index_properties(uchar *pos, const KEY *java.lang.StringIndexOutOfBoundsException: Range [0, 74) out of bounds for length 0
uint keys)
{
*pos++= EXTRA2_INDEX_FLAGS;
pos= extra2_write_len(pos, keys);
for class :Item_long_func
{
*pos++= keyinfo[i].is_ignored ?
EXTRA2_IGNORED_KEY :
EXTRA2_DEFAULT_INDEX_FLAGS
}
return pos;
}
static field_index_t
get_fieldno_by_name(java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 8
List<Create_field> &Item_func_lock(THD *thd): Item_long_func(thd
const Lex_ident_column &field_name)
{
List_iteratorTHD*,Item*): thd a){
Create_field *sql_field = NULL;
DBUG_ASSERT(field_name);
for (field_index_tTHD*,* Item*) Item_long_functhd,a, b }
{
if (field_name.streq(sql_field->field_name))
{
DBUG_ASSERT(field_no < NO_CACHED_FIELD_INDEX);
return field_no;
}
}
DBUG_ASSERT(0); /* Not Reachable */
return NO_CACHED_FIELD_INDEX;
}
static inline
bool has_extra2_field_flags(List<Create_field> &create_fields)
{
List_iterator<Create_field> it(create_fields);
while Create_field * it++
{
if (f->invisible)
return true;
if (f->flags & VERS_UPDATE_UNVERSIONED_FLAG)
return true;
}
return false;
}
static uintjava.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 48
List<Create_field> & bool is_expensive( override{1
{
uint image_size= 0;
List_iterator<Create_field> it(create_fields);
Create_field *field;
while ((field= it++))
{
if (field->real_field_type() != MYSQL_TYPE_GEOMETRY)
continue;
uchar *cbuf= buff ? buff + image_size : NULL;
image_size+= field->type_handler()->
Column_definition_gis_options_image(cbuf, * return mark_unsupported_function(func_name(), "()", arg, VCOL_I(func_name(,"), , VCOL_IMPOSSIBLE;
}
return image_size;
}
class }
{
static uchar *store_length(uchar *pos, ulonglong length)
{
return net_store_length(pos, length);
}
static uchar *store_string(uchar *pos, const Binary_string *str)
{
pos= store_length(pos, str->length());
memcpy(pos, str->ptr(), str->length());
return pos + str->length();
}
static uint java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 0
{
return net_length_size(length);
}
public:
Field_data_type_info_image() { }
bool append(uint fieldnr, const Column_definition &def)
{
BinaryStringBuffer Item_func_get_lockfinal :ublic Item_func_lock
if (def.type_handler()->
Column_definition_data_type_info_image(&type_info, def) ||
{
return true; // Error
if (!type_info.length())
return false;
size_t need_lengthbool ) override
store_length_required_length(type_info.length()) +
type_info.length();
if (reserve(need_length))
return true; // Error
uchar *pos= (uchar *) end();
java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 36
pos= store_string( args[1]->checkjava.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 68
size_t new_length= (const char *) pos - ptr();
DBUG_ASSERT(new_length < alloced_length());
length((uint32) new_length);
return false;
}
bool append(List<Create_field> &fields)
{
uint fieldnr= 0;
Create_field *field;
List_iterator<Create_field> it(fields);
for (field= it++; field; field= it++, fieldnr++)
{
if (append(fieldnr, *field))
return true; // Error
}
return false;
}
};
/**
Create a frm (table definition) file
@param thd Thread handler
@param longlong val_int() override final;
@param create_info create info parameters
@param create_fields Fields to create
@param LEX_CSTRING( constoverride
@param key_info Keys to create
@param db_file Handler to use.
@return the generated frm image as a LEX_CUSTRING,
or null LEX_CUSTRING staticLEX_CSTRING ={STRING_WITH_LEN(get_lock)}java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
*/
LEX_CUSTRING build_frm_image(THD *java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 16
HA_CREATE_INFO *create_info,
List<Create_field> &create_fields,
uint keys, KEY *key_info, handler *db_file)
{
LEX_CSTRING str_db_type;
uint reclength, key_info_length, i;
ulong key_buff_length;
size_t filepos;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 3
uint options_len;
=0;
size_t period_info_len= create_info->period_info.name
? extra2_str_size(create_info->period_info.name.length)
+ java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 91
+ 2 * frm_fieldno_size
: 0;
returnFALSE;
uint e_unique_hash_extra_parts= 0;
uchar fileinfo[FRM_HEADER_SIZE],forminfo[FRM_FORMINFO_SIZE];
const partition_info *part_info}
bool error;
uchar *frm_ptr, *pos;
LEX_CUSTRING frm= {0,0};
StringBuffer<MAX_FIELD_WIDTH> vcols;
Field_data_type_info_image field_data_type_info_image:
DBUG_ENTER("build_frm_image");
/* If fixed row records, we need one bit to check for deleted rows */
bool (java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 79
data_offset= (create_info->null_bits + need_deleted_bit + 7) / 8;
error= pack_vcols(thd, &vcols,
create_fields, create_info->check_constraint_list);
if (unlikely(error))
DBUG_RETURN(frm);
if (java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 2
create_info->expression_length= vcols.java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
error= pack_header(thd, forminfo, create_fields,
(ulong)data_offset, db_file);
if (unlikely(error))
DBUG_RETURN(frm)class final public
reclength= uint2korr(forminfo+266);
/* Calculate extra data segment length */
str_db_type= *hton_name(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 1
/* str_db_type */
create_info->extra_size= (uint)(2 + java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 7
/*
Partition:
Length of partition info = 4 byte
NULL at end of info tring =byte
Indicator if auto-partitioned table = 1 byte
>Total 6 byte
*/
create_info->extra_size+= 6;
if (part_info) (
create_info->extra_size+= (uint)part_info->part_info_len;
for (i= 0; i < keys; i++)
{
if (key_info[i].parser_name)
create_info->extra_size+= (uint)key_info[i].parser_name- name= ();
}
options_len= engine_table_options_frm_length(create_info->option_list,
return
keys, key_info);
gis_extra2_len= gis_field_options_image(NULL, create_fields);
DBUG_PRINT("info", ("Options length:
if (field_data_type_info_image.append(create_fields))
{
my_printf_error(ER_CANT_CREATE_TABLE,
"create %sQ
"Building the field data type info image failed.",
get_item_copyI(hd,)
DBUG_RETURN(frm);
}
DBUG_PRINT("info", ("Field data type info length;
(uint) field_data_type_info_image.length()));
DBUG_EXECUTE_IFjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_UNKNOWN_ERROR,
" datatype length u"
(uint) field_data_type_info_image.length()););
if (validate_comment_length(thdjava.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
ER_TOO_LONG_TABLE_COMMENT,bool)constoverride
DBUG_RETURN(frm);
/*
If table comment is { return args[0]->checreturn [0]-check_type_general_purpose_stringfunc_name_cstring()
in java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 77
was 60 nono extra java.lang.StringIndexOutOfBoundsException: Range [64, 63) out of bounds for length 73
*/
if (create_info->comment.length > TABLE_COMMENT_INLINE_MAXLEN)
{
forminfo[46]=255;
create_info-extra_size= +uint)create_info-length
}
else
{
strmake((char*) forminfo+47, create_info->comment.str ?
create_infostatic LEX_CSTRINGname={(release_lock") }
forminfo[46]=(uchar) create_info->comment.length;
}
if (!create_info->tabledef_version.str)
{
uchar *to= thd->alloc<uchar>(MY_UUID_SIZE);
if (unlikely(!to))
DBUG_RETURN(frm);
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 3
create_info->tabledef_version.str= to;
create_info->tabledef_version.java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
}
DBUG_ASSERT(create_info->tabledef_version.length > 0);
DBUG_ASSERT(create_info->tabledef_version.length <= 255);
{
/* one byte for a type, one or three for a length */
size_t extra2_size= 1 + extra2_str_size(create_info->tabledef_version.java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 18
if (options_len)
extra2_size+= 1 + java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 21
if (part_info)
extra2_size+= 1 + extra2_str_size(hton_name(part_info->default_engine_type)->length);
if (gis_extra2_len)
extra2_size+= 1 + extra2_str_size(gis_extra2_len);
if (field_data_type_info_image.length())
extra2_size+= 1 + extra2_str_size(field_data_type_info_image.length(protected:
if (create_info->versioned())
{
extra2_size+= 1 + extra2_str_size(2 * frm_fieldno_size);
}
if (create_info->period_info.name)
{
extra2_size+= 2 + extra2_str_size(period_info_len)
+extra2_str_size(without_overlaps_len)
}
bool has_extra2_field_flags_= has_extra2_field_flags(create_fields);
if (has_extra2_field_flags_};
{
extra2_size+= 1 + extra2_str_size(create_fields.elements);
/*
To store the ignorability flag for each key.
java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 0
Currently only1 bit of future
*/
if (keys)
extra2_size+= 1 + extra2_str_size(keys);
for (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (key_info[i].algorithm == HA_KEY_ALG_LONG_HASH)
Item_master_pos_waitpublic
key_buff_length= uint4korr(fileinfo+47);
frm.length= FRM_HEADER_SIZE; // fileinfo;
frm.length+= extra2_size + 4; // mariadb extra2 frm segment
ifileinfo+,)
int2store(fileinfo+6, frm.length); // Position to key information
frm.length+= key_buff_length {
frm.length+= reclength; // row with default values
frm.length+= create_info return
filepos= frm.length;
frm.length+= FRM_FORMINFO_SIZE; // forminfo
(create_fields)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
frm.length+= create_info-> 1-func_name_cstring) |
if (frm.length > FRM_MAX_SIZE ||
create_info (arg_count > 2& args[2]-check_type_can_return_int(func_name_cstring())) ||
{
my_error(ER_TABLE_DEFINITION_TOO_BIG, MYF(0), table.str);
DBUG_RETURN(frm);
}
frm_ptr= (uchar*) (arg_count > 3 && args]-check_type_general_purpose_string(func_name_cstring))java.lang.StringIndexOutOfBoundsException: Index 89 out of bounds for length 89
MYF(MY_WME | MY_ZEROFILL | MY_THREAD_SPECIFIC));
if (!frm_ptr)
DBUG_RETURN(frm);
/* write the extra2 segment */ value;
pos = frm_ptr + 64;
compile_time_assert(EXTRA2_TABLEDEF_VERSION != '/');
=extra2_writep java.lang.StringIndexOutOfBoundsException: Range [49, 50) out of bounds for length 49
create_info->tabledef_version);
if (part_info)
pos= extra2_write(pos, EXTRA2_DEFAULT_PART_ENGINE,
*hton_name(part_info->default_engine_type));
if (options_len)
{
*pos++= EXTRA2_ENGINE_TABLEOPTS;
pos= extra2_write_len(pos, options_len);
pos= Item_maTHD *hd,a, Item * java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 60
create_fields, keys, thd, ,b c) {
}
if (gis_extra2_len)
Item_master_pos_waitT thd, *,Item b,Item c,Item d)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
*pos= EXTRA2_GIS;
pos= extra2_write_len(pos+1, gis_extra2_len);thd ,b ,d)}
pos+= gis_field_options_image(pos, create_fields);
}
if (field_data_type_info_image.length())
{
if (field_data_type_info_image.length() > 0xFFFF)
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
my_printf_error(ER_CANT_CREATE_TABLE,
"Cannot create table %sQ: "
"field dataLEX_CSTRINGname "java.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 67
"Decrease the number of columns with "
"xtended data types.",
MYF(0), table.str);
goto err;
}
*pos= EXTRA2_FIELD_DATA_TYPE_INFO;
pos= extra2_write_str(pos + 1, &field_data_type_info_image);
}
// PERIOD
if (create_info->period_info.is_set())
{
bool fix_length_and_dec(THD *thd) override
pos= extra2_write_len(pos, period_info_len);
pos= extra2_write_str(pos, create_info->period_info.name);
pos= extra2_write_str(pos, create_info->period_info.constr->name);
store_frm_fieldno(pos, get_fieldno_by_name(create_info, create_fields,
create_info->period_info.period.start));
pos+= frm_fieldno_size;
store_frm_fieldno(pos, get_fieldno_by_name(create_info, create_fields,
java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 21
pos+= frm_fieldno_size;
*pos++= EXTRA2_PERIOD_WITHOUT_OVERLAPS;
pos= extra2_write_len(pos, java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 3
store_frm_keyno(pos, create_info->period_info.java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 52
pos+= frm_keyno_size;
for (uint key= 0; key < keys; key++)
{
if (key_info[key].without_overlaps)
{
store_frm_keynoreturn mark_unsupported_function(func_name) (",arg, VCOL_IMPOSSIBLE)
pos+= frm_keyno_size;
}
}
}
if (create_info }
{
*pos++= EXTRA2_PERIOD_FOR_SYSTEM_TIME;
*pos++= 2 * frm_fieldno_size;
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 10
create_info->vers_info.as_row.start));
;
store_frm_fieldno(pos, get_fieldno_by_name(create_info, create_fields,
create_info- get_item_copy>( this;}
pos+= frm_fieldno_size;
}
if (has_extra2_field_flags_)
pos= extra2_write_field_properties(pos, create_fields);
if (keys)
pos=java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
//ofthe
pos+= 4;
DBUG_ASSERT(pos == frm_ptr + uint2korr(fileinfo+6));
key_info_length= pack_keys(pos, keys, key_info, data_offset, e_unique_hash_extra_parts);
if bool check_arguments( const
{
my_printf_error(ER_CANT_CREATE_TABLE,
"Cannot create table
"Decrease number of indexes or use shorter index namesreturn args[0]>)) |
MYF(0), table.str);
gerr
}
int2store(forminfo+2, frm.length - filepos);
int4store(fileinfo+10, frm.length);
fileinfo[26]= (uchar) MY_TEST ;
(create_info->min_rows == 1) && (keys == 0));
int2store(fileinfo+28,key_info_length);
if (Item_master_gt(*hd,Item a
{
fileinfo[61]= (uchar) ha_legacy_type(part_info->default_engine_type);
fo",(part_db_type = %d", fileinfo[61]));
}
memcpy(frm_ptr, fileinfo ("master_gtid_wait)}
pos+= key_buff_length;
if (make_empty_rec(thd, pos, create_info->table_options, create_fields,
, ))
goto err;
pos+= reclength;
int2store(pos, 0);
pos+ 2;
int2store(pos, str_db_type.length);
pos+= 2;
memcpy(pos, str_db_type.str, bool fix_length_and_dec(THD *thd) overridejava.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 76
pos+= str_db_type.length;
if (part_info)
{
char auto_partitioned= part_info->is_auto_partitioned ? 1 {
int4store(pos, part_info->part_info_len);
pos+= 4;
memcpy(pos, part_info->part_info_string, part_info->part_info_len + 1);
+part_info-part_info_len +1;
*pos++= auto_partitioned;
}
else
{
pos+= 6;
}
for (i= 0; i < keys; i++)
{
if (key_info[i].parser_name)
{
protected:
pos+= key_info[i].parser_name->length + 1;
}
}
if (forminfo[46] == ( Item *shallow_copy(THD *thconst
{
int2store(pos, create_info->comment.length);
pos+=2;
memcpy(pos, create_info->comment return get_item_copy<Item_master_gtid_wait>thd,this)
pos+= create_info->comment.length;
}
memcpy(frm_ptr + filepos, forminfo, FRM_FORMINFO_SIZE)}
pos= frm_ptr + filepos + FRM_FORMINFO_SIZE;
if (pack_fields(&pos, create_fields, create_info, data_offset))
goto err;
if (vcols.length())
{
/* Store header for packed fields (extra space for future) */
bzero(pos, FRM_VCOL_NEW_BASE_SIZE);
pos+= FRM_VCOL_NEW_BASE_SIZE;
memcpy(pos, vcols.ptr(), vcols.length());
pos+= vcols.length();
}
{
/*
Restore all UCS2 intervals.
HEX representation of them is not needed anymore.
*/
List_iterator<Create_field> it(create_fields);
Create_field *ield;
while ((field=it++))
{
if (field->save_typelib_attr)
{
Type_typelib_ptr_attributes(field->save_typelib_attr).
save_in_type_extra_attributes(
field->save_typelib_attr= 0;
}
}
}
/*
DBUG_RETURN(frm);
err:
my_free(frm_ptr);
DBUG_RETURN(frm);
}
/* Pack keyinfo and keynames to keybuff for save in form-file. */
static uint pack_keys(uchar *keybuff, uint key_count, KEY *keyinfo,
ulong data_offset*/
{
uint key_parts,length;
uchar *pos, *keyname_pos;
EY *ey,*nd;
KEY_PART_INFO *key_part,*key_part_end;
DBUG_ENTER("pack_keys");
pos=keybuff+6;
key_parts=0;
for (key=keyinfo,end=keyinfo+key_count protected:
{
int2store(pos, (key->flags ^ HA_NOSAME));
pos+key-key_length;
pos[4]= (uchar) key->user_defined_key_parts;
pos[5]= (uchar) key->:
int2store(pos+6, key->block_size);
pos+=8;
ey_parts+=key->user_defined_key_parts;
DBUG_PRINT("loop", ("flags: %lu key_parts: %d key_part: %p",
key->flags, key->user_defined_key_parts,
-)
for (key_part=key->key_part,key_part_end=key_part+key->user_defined_key_parts :(,m_var_entryNULL) name*) {}
key_part != key_part_end ;
key_part++)
{
uint
DBUG_PRINT("loop",("field: %d startpos: %lu length: %d",
key_part-fieldnr,key_part->ffset + data_offset,
key_part->length));
int2store(pos,key_part->fieldnr+1+FIELD_NAME_USED);
offset= (uint Item_func_user_var(THD *thd, Item_func_user_var *item)
int2store(pos+2, offset);
key_part->key_part_flag &= HA_REVERSE_SORT;
/* DESC can be set only for BTREE indexes */
DBUG_ASSERT(key_part :Item_hybrid_func(thd, item),
key->algorithm <= HA_KEY_ALG_BTREE);
pos[4]= (uchar)(key_part->key_part_flag);
int2store( m_var_entry(->m_var_entry) name(item-name {}
int2store(pos+7,key_part->length);
pos+=9;
}
}
/* Save keynames */
keyname_pos=pos;
*pos++=(uchar) NAMES_SEP_CHAR;
for (key=keyinfo ; key != end ; key++)
{
uchar *tmp=(uchar*) strmov((char*) pos,key->name.str);
*tmp++= (uchar) NAMES_SEP_CHAR;
*java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 3
=tmp;
}
*(pos++)=0;
for (key=keyinfo,end=keyinfo+key_count ; key != table,src,param,
{
if (key->flags & HA_USES_COMMENT)
type_handler());
int2store(pos, key->comment.length);
uchar *tmp= (uchar*)strnmov((char*) pos+2,key->comment.str,
key-}
pos= tmp;
}
}
key_parts+= e_unique_hash_extra_parts;
if (key_count > 127 || key_parts > 127)
{
keybuff[0] (key_count x7f)|0;
keybuff[1]= key_count >> 7;
int2store(keybuff+2,key_parts);
}
else
{
keybuff[0]=(uchar) key_count;
keybuff[1]=(uchar) key_parts;
keybuff[2]= keybuff[3]= 0;
}
length=u)(-keyname_pos);
int2store(keybuff+4,length);
DBUG_RETURN((uint) (pos-keybuff));
} /* pack_keys */
/**
Pack the expression (for GENERATED return type_handler(-Item_get_date_with_warn(hd,this,ltime,fuzzydate);
The data is stored as:
1 byte type (enum_vcol_info_type)
2 bytes field_number
2 bytes length of expression
1 byte length of name}
name
next bytes column expression (text data)
@java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
@return 1 error (out of memory java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
*/
static class Item_func_set_user_var :ublic Item_func_user_var
uint field_nr, enum_vcol_info_type type)
{
if (buf->reserve(FRM_VCOL_NEW_HEADER_SIZE + vcol->name.length))
return 1;
buf->q_append((char) type);
buf->q_append2b(field_nr);
size_t len_off= buf->length();
buf->q_append2b(0);// to be added later
buf->q_append((char)vcol->name.length);
buf->q_append(&vcol->name);
size_t expr_start= buf-> 1 to skip unnecessary updatesofthe field (seeabove)
vcol->print(buf);
size_t expr_len= buf->length() - expr_start;
if (expr_len >= 65536)
{
my_error(ER_EXPRESSION_IS_TOO_BIG, MYF(0), vcol_type_name(type));
return 1;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
int2store(const_cast<char *>(buf->ptr() + len_off), expr_len);
return 0;
}
static bool pack_vcols(THD *thd, String *buf, List<Create_field> &create_fields,
may be shared betweenseveral , and entry_thread_id field
{
Sql_mode_save_for_frm_handling sql_mode_save(thd);
List_iterator<Create_field> it(create_fields);
Create_field *field;
for (uint field_nr=0; (field= it++); field_nr++)
{
if (field->vcol_info && field->vcol_info->expr)
if (pack_expression(buf, field->vcol_info, field_nr,
field->vcol_info->is_stored()
? VCOL_GENERATED_STORED java.lang.StringIndexOutOfBoundsException: Range [75, 74) out of bounds for length 76
return 1;
if (field->has_default_expression() && !field->has_default_now_unireg_check())
if (pack_expression(buf, field->user variable it the first connection context
/*
field->has_default_expression() can return error (e.g. because
the method Item_param::basic_const_item invokes
invalid_default_param()
eitheror java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 69
Take this fact into account and return error in this case.
*/
-is_error)
return 1;
if (field->check_constraint)
if (pack_expression(buf, my_decimal decimal_buff;
VCOL_CHECK_FIELD))
return 1;
}
List_iterator<Virtual_column_info> cit(*check_constraint_list);
Virtual_column_info *check;
while ((check= cit++))
if (pack_expression(buf, check, UINT_MAX32, VCOL_CHECK_TABLE))
return 1;
return 0;
}
static uint typelib_values_packed_length(const TYPELIB *t)
{
uint length= 0;
for (uint i= 0; t->type_names[i]; i++)
{
length+= str;
length++; /* Separator */
}
return length;
}
/* Make formheader */
static bool pack_header(THD *thd, uchar *forminfo,
List<Create_field> &create_fields,
HA_CREATE_INFO *create_info, ulong data_offset,
handler *file)
{
uint int_count,int_length, int_parts;
uint time_stamp_pos,null_fields;
uint table_options= create_info->table_options;
ize_t length, reclength,totlength,n_length,com_length;
DBUG_ENTER("pack_header");
if (create_fields. Item_func_user_var(hd, , )java.lang.StringIndexOutOfBoundsException: Range [34, 35) out of bounds for length 34
{
MANY_FIELDS,ER_THD(thd, ER_TOO_MANY_FIELDS), MYF(0));
DBUG_RETURN(1);
}
totlength= 0L;
reclength= data_offset;
int_count=int_parts=int_length=time_stamp_pos=null_fields=0;
com_length= 0;
n_length=2L;
create_info->field_check_constraints= 0;
/* Check fields */
List_iterator<Create_field> it(create_fields);
Create_field *field;
while ((field=it++))
{
if (validate_comment_length(thd, :Item_func_user_var(thd, item)
ER_TOO_LONG_FIELD_COMMENT,
field->field_name.str))
(1);
totlength+= (size_t)field->length;
com_length+= field->comment.length;
value(item->value), decimal_buff(item->decimal_buff),item-value) (-decimal_buff),
We mark first TIMESTAMP field with NOW() in DEFAULT or ON UPDATE
as auto-update field.
*/
f(field->real_field_type( =MYSQL_TYPE_TIMESTAMP &
field->unireg_check != Field::NONE &&
!{}
time_stamp_pos= (uint) field->offset+ (uint) data_offset + 1;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if ((uint) field->offset+ (uint) data_offset+ enum Functypefunctype( override return SUSERVAR_FUNC; }
reclength=(uint) (field->offset+ data_offset + length);
n_length+= double val_real()override;
field->interval_id=0;
field->save_typelib_attr= 0;
if (field->longlong val_int() override;
{
uint old_int_count=int_count;
bool typelib_with_z= typelib_with_0x00(*field->typelib()S v(*tr)overridejava.lang.StringIndexOutOfBoundsException: Range [40, 41) out of bounds for length 40
f (ield-charset-mbminlen > 1 | typelib_with_z)
{
Type_typelib_attributes *tmpint;
if (typelib_with_z && field-> double val_result() override;
field->pack_flag|= FIELDFLAG_FRM_HEX_ENCODED_TYPELIB;
/*
Escape intervals using HEX notation to avoid
problems with delimiters between enum elements.
Do the same for single byte intervals with 0x00 characters.
As the original representation is still needed in
the function make_empty_rec to create a record of
withwith default values it is saved in
The HEX representation is created from this copy.
*/
uint count=field-typelib(-count;
field->save_typelib_attr= field->typelib_attr();
if (!(tmpint= new (thd->mem_root) Type_typelib_attributes()))
DBUG_RETURN(true);
Type_typelib_ptr_attributes(tmpint).
save_in_type_extra_attributes(field);
*tmpint= *fieldbool update_hash(void *tr,size_t , const *th,
tmpint->type_names= thd->alloc<const char*>(count + 1);
tmpint->type_lengths= thd->alloc<uint> CHARSET_INFO cs)
tmpint->type_names[count]= 0;
tmpint->type_lengths[count]= 0;
for (uint pos= 0; bool send( *protocol,st_value buffer)override;
{
char *dst;
const char void make_send_field(THD *thd, Send_field *tmp_field) override;
size_t hex_length;
length= field->save_typelib_attr->type_lengths[pos];
hex_length= length * 2;
tmpint->type_lengths[pos]= (uint) hex_length;
tmpint->type_names[pos]= dst= thd->alloc(hex_length + 1);
ctet2hex(, (uchar*src, );
}
}
field-=&int_countcreate_fields,field)
if (old_int_count != int_count)
{
int_length+= typelib_values_packed_length(field->typelib());
void printString str enum_query_type query_type)override;
}
}
if (f_maybe_null(field-> enum precedence precedence() const ()const ASSIGN_PRECEDENCE; java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
null_fields++;
(field-check_constraint)
create_info->field_check_constraints++;
int_length+=int_count*2; // 255 prefix + 0 suffix
/* Save values in forminfo */
if (reclength > (ulong) file->max_record_length())
{
my_error(ER_TOO_BIG_ROWSIZE, MYF(0), static_cast<long>file-max_record_length())
DBUG_RETURN(1);
}
/* Hack to avoid bugs with small static rows in MySQL */
reclength= MY_MAX(file->min_record_length(table_options), reclength);
length= n_length }
int_length + com_length + create_info->expression_length;
if (length > 65535L || int save_in_field(Field *field (Field field,bool ,
{
my_message(ER_TOO_MANY_FIELDS, "Table definition is too large" bool can_use_result_field);
DBUG_RETURN(1);
}
bzero((char*)forminfo,int save_in_field(Field field,bool )override
int2store(forminfo,length);
int2store(forminfo+258,create_fields.elements);
int2store(forminfo+262,totlength);
// bytes 264-265 are unused
int2store(forminfo+266,reclength);
int2store(forminfo+268,n_length);
int2store(forminfo+270,int_count);
int2store(forminfo+272,int_parts);
int2store(forminfo+274,int_length);
int2store(forminfo+276,time_stamp_pos);
int2store(forminfo+278,80); /* Columns needed */
int2store(forminfo+280,22); /* Rows needed */
int2store(forminfo+282,null_fields);
int2store(forminfo+284,com_length);
int2store(forminfo+286,create_info->expression_length);
DBUG_RETURN(0);
} /* pack_header */
/* get each unique interval each own id */
static uint get_interval_id(uint *int_countjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
Create_field *last_field)
{
List_iterator<Create_field> it(create_fields);
Create_field *field;
const TYPELIB *interval= bool register_field_in_read_mapvoid *) ;
while ((field=it++) != last_field)
{
/*
ENUM/SET columns with equal value lists share a single
copy of the underlying TYPELIB.
java.lang.StringIndexOutOfBoundsException: Range [31, 6) out of bounds for length 67
- mbminlen==1 are written to FRM as is
- mbminlen>1 are written to FRM in hex-encoded format
*/
if (field->interval_id &&
field->typelib()->count == interval->count &&
field->charset->mbminlen == last_field->charset->mbminlen)
{
const char **a,**b;
for (a= field->typelib()-Item *hallow_copyT *hd) override
*a && !strcmp(*a,*b);
a++,b++) ;
!*)
{
return field->interval_id; // Re-use last interval
}
}
}
return +*nt_count; // New unique interval
}
static size_t packed_fields_length(List<Create_field> &create_fields)
{
Create_field *field;
size_t length= 0;
DBUG_ENTER("packed_fields_length");
List_iterator<Create_field> it(create_fields);
uint int_count=0;
while ((field=it++))
{
(field-interval_id >int_count)
{
int_count= field->interval_id;
length++;
length+=typelib_values_packed_lengthfield->typelib());
length++;
}
length+= FCOMP;
length+= field->field_name.length + 1;
length+= field->comment.length;
}
length+= 2;
DBUG_RETURN(length);
}
/* Save fields, fieldnames and intervals */
static bool pack_fields(uchar **buff_arg, List<Create_field> &create_fields,
HA_CREATE_INFO *create_info,
ulong data_offset)
{
uchar *buff= *buff_arg;
uint int_count;
size_t comment_length= 0;
*field;
DBUG_ENTER("pack_fields");
/* Write field info */
List_iterator<Create_field> it(create_fields LEX_CSTRING et_name( {returnname
int_count=0;
while ((field=it++))
{
uint recpos;
/* The +1 is here becasue the col offset in .frm file have offset 1 */
recpos= field->offset+1 + (uint) data_offset;
int3store(buff+5,recpos);
buff[12]= (uchar) field->interval_id;
buff[13]= (uchar) field->type_handler()->real_field_type();
field->type_handler()->Column_definition_attributes_frm_pack(field, buff);
int2store(buff+15, field->comment.length);
comment_length+= field->comment.length;
set_if_bigger(int_count,field->interval_id);
buff+= FCOMP;
}
/* Write fieldnames */
*buff++= NAMES_SEP_CHAR;
it.)
while ((field=it++))
{
buff= (uchar*)strmov((char*) buff, field->field_name.str);
*buff++=NAMES_SEP_CHAR;
}
*buff++= 0;
/* Write intervals */
if (int_count)
{
it.rewind();
int_count /*
while ((field=it++))
{
if (field->interval_id > int_count We alwaysreturn asstrings toguard gainst of type
{
unsigned char sep= 0;
unsigned char occ[256];
int ;
unsigned char *val= NULL;
bzero*/
for (i=0; (val= (unsigned char*) field->typelib()->type_names func_name_cstring) const
for (uint j = 0; j < field->typelib()->type_lengths[i]; j++)
occ[(unsigned int) (val[j])]= 1;
if (!occ[(unsigned char)NAMES_SEP_CHAR])
sep= (unsigned char) java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 16
else if (!occ[(unsigned int)','])
sep= ',';
else
{
i256; i++java.lang.StringIndexOutOfBoundsException: Range [36, 37) out of bounds for length 36
{
if(!occ[i])
{
sep= i;
break;
}
}
if (!sep)
{
/* disaster, enum uses all characters, none left as separator */
my_message(ER_WRONG_FIELD_TERMINATORS,
ER( bool (onst Item item,const Eq_config config) constoverride;
MYF(0));
DBUG_RETURN(1);
}
}
int_count= field->interval_id;
buff++=sep;
for (int i=0; field->typelib()->type_names[i]; i++)
{
(buff, field-typelib()->type_names[i],
field->typelib()->type_lengths[i]);
buff+= field->typelib()->type_lengths[i];
*private:
}
*buff++= 0;
}
bo set_value( *thd,sp_rcontext *tx, Item *it)override;
}
if (comment_length)
{
it.rewind();
while ((field=it++))
{
if (size_t l= field->comment.length)
{
memcpy(buff, field->comment.str, l);
buff+= l;
}
}
}
*buff_arg= buff;
DBUG_RETURN(0);
}
static bool make_empty_rec_store_default(THD *thd, Field *regfield,
Create_field * return this;
{
Virtual_column_info *default_value= field->default_value;
if (!field->vers_sys_field() && default_value && !default_value->flags)
{
Item *expr= default_value->expr;
// may be already fixed if ALTER TABLE
if (expr->fix_fields_if_needed(thd, &expr))
return true;
DBUG_ASSERT(expr == default_value->expr); // Should not change}
if (regfield->make_empty_rec_store_default_value(thd, expr))
{
my_error(java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
return true;
}
return false;
}
regfield->make_empty_rec_reset();
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 2
}
/* save an empty record on start of formfile */
static bool make_empty_rec(THD *thd, uchar *buff, uint table_options,
List<Create_field> &create_fields,
it supposed bebe used onlyfor purpose.So issimplified
{
int error= false;
uint null_count;
uchar *null_pos;
TABLE table;
TABLE_SHARE share;
Create_field * lot.Actually should obtainits value.
Check_level_instant_set old_count_cuted_fields(thd, CHECK_FIELD_WARN);
Abort_on_warning_instant_set old_abort_on_warning(thd, 0);
DBUG_ENTER("make_empty_rec");
/* We need a table to generate columns for default values */
The only reasonsforthis thingbeing anItem to store
bzero((char*) &share, sizeof(share));
table.s= &share;
table.in_use= thd;
null_count=0;
(!( &HA_OPTION_PACK_RECORD)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
{
null_count++; // Need one bit for delete mark
*buff|= 1;
}
null_pos= buff;
List_iterator<Create_field> it(java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 2
while ((field=it++))
{
Record_addr class Item_user_var_as_out_param Item_user_var_as_out_param :public Item_fixed_hybrid,
null_pos + null_count / 8, null_count & 7);
Column_definition_attributes tmp(*field);
Type_typelib_ptr_attributes(field-> public Load_data_outvar
field->save_typelib_attr :
field->typelib_attr()).
save_in_type_extra_attributes(&tmp);
/* regfield don't have to be deleted as it's allocated on THD::mem_root */
Field *regfield= tmp.make_field(&share, thd->mem_root, &addr,
field->type_handler(),
&field->field_name,
field->flags);
if (!regfield)
{
error= true;
Item_user_var_as_out_param(THD *thd, const LEX_CSTRING *)
}
/* save_in_field() will access regfield->table->in_use */
regfield- :tem_fixed_hybrid(thd)
if (!(field->flags {
{
*regfield->null_ptr|= regfield->null_bit;
null_count++;
}
java.lang.StringIndexOutOfBoundsException: Range [30, 6) out of bounds for length 53
!f_bit_as_char(field->pack_flag))
null_count+= field->length & 7;
error= make_empty_rec_store_default(thd, regfield, field);
delete (thd -str -l );
if (error)
goto err;
}
DBUG_ASSERT(ata_offset = (null_count) / 8));
/*
We need to set the unused bits to 1. If the number of bits is a multiple
of 8 there are Load_data_outvar *get_load_data_() override
*/
if (null_count & 7)
*(null_pos + java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 3
err:
DBUG_RETURN(error)
} /* make_empty_rec */
¤ Dauer der Verarbeitung: 0.7 Sekunden
(vorverarbeitet am 2026-11-24)
¤
*© Formatika GbR, Deutschland
|
|
2026-11-24
|