763
763
keyinfo->flags|= HA_USES_COMMENT;
764
764
keyinfo->comment.length= indx.comment().length();
765
keyinfo->comment.str= strdup(indx.comment().c_str(), keyinfo->comment.length);
765
keyinfo->comment.str= mem().strdup(indx.comment());
768
keyinfo->name= strdup(indx.name().c_str(), indx.name().length());
768
keyinfo->name= mem().strdup(indx.name());
770
770
addKeyName(string(keyinfo->name, indx.name().length()));
932
932
for (int n= 0; n < field_options.field_value_size(); n++)
934
t->type_names[n]= strdup(field_options.field_value(n).c_str(), field_options.field_value(n).length());
934
t->type_names[n]= mem().strdup(field_options.field_value(n));
937
937
* Go ask the charset what the length is as for "" length=1
938
938
* and there's stripping spaces or some other crack going on.
941
lengthsp= charset->cset->lengthsp(charset,
943
field_options.field_value(n).length());
944
t->type_lengths[n]= lengthsp;
940
t->type_lengths[n]= charset->cset->lengthsp(charset, t->type_names[n], field_options.field_value(n).length());
1004
size_t len= pfield.comment().length();
1005
const char* str= pfield.comment().c_str();
1007
comment.str= strdup(str, len);
1008
comment.length= len;
1000
comment.str= mem().strdup(pfield.comment());
1001
comment.length= pfield.comment().size();
1011
1004
enum_field_types field_type;
1611
int TableShare::open_table_from_share_inner(Session *session,
1604
int TableShare::open_table_from_share_inner(Session *session, const char *alias, uint32_t db_stat, Table &outparam)
1618
unsigned char *record= NULL;
1622
1607
outparam.resetTable(session, this, db_stat);
1624
1609
outparam.setAlias(alias);
1668
1653
memcpy(outparam.getUpdateRecord(), getDefaultValues(), null_bytes);
1671
field_ptr = new (outparam.mem()) Field*[_field_size + 1];
1656
Field** field_ptr = new (outparam.mem()) Field*[_field_size + 1];
1673
1658
outparam.setFields(field_ptr);
1693
1678
/* Fix key->name and key_part->field */
1696
KeyInfo *local_key_info, *key_info_end;
1697
KeyPartInfo *key_part;
1699
n_length= keys*sizeof(KeyInfo) + key_parts*sizeof(KeyPartInfo);
1700
local_key_info= (KeyInfo*) outparam.alloc(n_length);
1681
uint32_t n_length= keys * sizeof(KeyInfo) + key_parts * sizeof(KeyPartInfo);
1682
KeyInfo* local_key_info= (KeyInfo*) outparam.alloc(n_length);
1701
1683
outparam.key_info= local_key_info;
1702
key_part= (reinterpret_cast<KeyPartInfo*> (local_key_info+keys));
1684
KeyPartInfo* key_part= reinterpret_cast<KeyPartInfo*>(local_key_info+keys);
1704
1686
memcpy(local_key_info, key_info, sizeof(*local_key_info)*keys);
1705
memcpy(key_part, key_info[0].key_part, (sizeof(*key_part) *
1687
memcpy(key_part, key_info[0].key_part, sizeof(*key_part) * key_parts);
1708
for (key_info_end= local_key_info + keys ;
1709
local_key_info < key_info_end ;
1689
for (KeyInfo* key_info_end= local_key_info + keys; local_key_info < key_info_end; local_key_info++)
1712
KeyPartInfo *key_part_end;
1714
1691
local_key_info->table= &outparam;
1715
1692
local_key_info->key_part= key_part;
1717
for (key_part_end= key_part+ local_key_info->key_parts ;
1718
key_part < key_part_end ;
1694
for (KeyPartInfo* key_part_end= key_part+ local_key_info->key_parts; key_part < key_part_end; key_part++)
1721
1696
Field *local_field= key_part->field= outparam.getField(key_part->fieldnr-1);
1723
if (local_field->key_length() != key_part->length &&
1724
!(local_field->flags & BLOB_FLAG))
1698
if (local_field->key_length() != key_part->length && not (local_field->flags & BLOB_FLAG))
1727
1701
We are using only a prefix of the column as a key:
2005
1979
case DRIZZLE_TYPE_TIME:
2006
return new (&mem_root) field::Time(ptr,
1980
return new (&mem_root) field::Time(ptr, field_length, null_pos, null_bit, field_name);
2011
1981
case DRIZZLE_TYPE_DATE:
2012
return new (&mem_root) Field_date(ptr,
1982
return new (&mem_root) Field_date(ptr, null_pos, null_bit, field_name);
2016
1983
case DRIZZLE_TYPE_DATETIME:
2017
return new (&mem_root) Field_datetime(ptr,
1984
return new (&mem_root) Field_datetime(ptr, null_pos, null_bit, field_name);
2021
1985
case DRIZZLE_TYPE_NULL:
2022
return new (&mem_root) Field_null(ptr,
1986
return new (&mem_root) Field_null(ptr, field_length, field_name);