diff options
author | unknown <serg@serg.mylan> | 2003-10-21 11:58:43 +0200 |
---|---|---|
committer | unknown <serg@serg.mylan> | 2003-10-21 11:58:43 +0200 |
commit | eaf1b192a65477317d54438bb9b3c69de1370e2e (patch) | |
tree | 8d1d6d06c790efe700899d57a87e63e8d91764f4 /sql/table.cc | |
parent | c63e573399e53a23172a6a50fdcbe80c41da7d1d (diff) | |
parent | 3c2e50d772d0ed25dea73da277d84818dc151dd5 (diff) | |
download | mariadb-git-eaf1b192a65477317d54438bb9b3c69de1370e2e.tar.gz |
merged
BitKeeper/etc/ignore:
auto-union
include/m_ctype.h:
Auto merged
mysql-test/r/mysqldump.result:
Auto merged
sql/field.cc:
Auto merged
sql/ha_berkeley.cc:
Auto merged
sql/handler.h:
Auto merged
sql/item.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/opt_range.cc:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_test.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.cc:
Auto merged
strings/ctype-simple.c:
Auto merged
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/sql/table.cc b/sql/table.cc index be5b7edfd93..24c5b941c0b 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -137,10 +137,11 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, outparam->raid_type= head[41]; outparam->raid_chunks= head[42]; outparam->raid_chunksize= uint4korr(head+43); - if (!(outparam->table_charset=get_charset((uint) head[38],MYF(0)))) - outparam->table_charset=default_charset_info; // QQ display error message? + outparam->table_charset=get_charset((uint) head[38],MYF(0)); null_field_first=1; } + if (!outparam->table_charset) /* unknown charset in head[38] or pre-3.23 frm */ + outparam->table_charset=default_charset_info; outparam->db_record_offset=1; if (db_create_options & HA_OPTION_LONG_BLOB_PTR) outparam->blob_ptr_size=portable_sizeof_char_ptr; @@ -155,10 +156,23 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, VOID(my_seek(file,(ulong) uint2korr(head+6),MY_SEEK_SET,MYF(0))); if (read_string(file,(gptr*) &disk_buff,key_info_length)) goto err_not_open; /* purecov: inspected */ - outparam->keys=keys= disk_buff[0]; - outparam->keys_for_keyread= outparam->keys_in_use= set_bits(key_map, keys); + if (disk_buff[1] & 0x80) + { + outparam->keys= keys= uint2korr(disk_buff) & 0x7fff; + outparam->key_parts= key_parts= uint2korr(disk_buff+2); + } + else + { + outparam->keys= keys= disk_buff[0]; + outparam->key_parts= key_parts= disk_buff[1]; + } + outparam->keys_for_keyread.init().set_prefix(keys); + outparam->keys_in_use.init().set_prefix(keys); + outparam->read_only_keys.init().clear_all(); + outparam->quick_keys.init(); + outparam->used_keys.init(); + outparam->keys_in_use_for_query.init(); - outparam->key_parts=key_parts=disk_buff[1]; n_length=keys*sizeof(KEY)+key_parts*sizeof(KEY_PART_INFO); if (!(keyinfo = (KEY*) alloc_root(&outparam->mem_root, n_length+uint2korr(disk_buff+4)))) @@ -263,7 +277,9 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, record[outparam->reclength]=0; // For purify and ->c_ptr() outparam->rec_buff_length=rec_buff_length; if (my_pread(file,(byte*) record,(uint) outparam->reclength, - (ulong) (uint2korr(head+6)+uint2korr(head+14)), + (ulong) (uint2korr(head+6)+ + ((uint2korr(head+14) == 0xffff ? + uint4korr(head+10) : uint2korr(head+14)))), MYF(MY_NABP))) goto err_not_open; /* purecov: inspected */ /* HACK: table->record[2] is used instead of table->default_values here */ @@ -484,8 +500,8 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, index_flags=outparam->file->index_flags(key); if (!(index_flags & HA_KEY_READ_ONLY)) { - outparam->read_only_keys|= ((key_map) 1 << key); - outparam->keys_for_keyread&= ~((key_map) 1 << key); + outparam->read_only_keys.set_bit(key); + outparam->keys_for_keyread.clear_bit(key); } if (primary_key >= MAX_KEY && (keyinfo->flags & HA_NOSAME)) @@ -545,7 +561,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, field->key_length() == keyinfo->key_length ? UNIQUE_KEY_FLAG : MULTIPLE_KEY_FLAG); if (i == 0) - field->key_start|= ((key_map) 1 << key); + field->key_start.set_bit(key); if (field->key_length() == key_part->length && !(field->flags & BLOB_FLAG)) { @@ -553,11 +569,11 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, (field->key_type() != HA_KEYTYPE_TEXT || (!(ha_option & HA_KEY_READ_WRONG_STR) && !(keyinfo->flags & HA_FULLTEXT)))) - field->part_of_key|= ((key_map) 1 << key); + field->part_of_key.set_bit(key); if ((field->key_type() != HA_KEYTYPE_TEXT || !(keyinfo->flags & HA_FULLTEXT)) && !(index_flags & HA_WRONG_ASCII_ORDER)) - field->part_of_sortkey|= ((key_map) 1 << key); + field->part_of_sortkey.set_bit(key); } if (!(key_part->key_part_flag & HA_REVERSE_SORT) && usable_parts == i) @@ -600,7 +616,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, keyinfo->usable_key_parts=usable_parts; // Filesort } if (primary_key < MAX_KEY && - (outparam->keys_in_use & ((key_map) 1 << primary_key))) + (outparam->keys_in_use.is_set(primary_key))) { outparam->primary_key=primary_key; /* @@ -1108,6 +1124,7 @@ File create_frm(register my_string name, uint reclength, uchar *fileinfo, key_length=keys*(7+NAME_LEN+MAX_REF_PARTS*9)+16; length=(ulong) next_io_size((ulong) (IO_SIZE+key_length+reclength)); int4store(fileinfo+10,length); + if (key_length > 0xffff) key_length=0xffff; int2store(fileinfo+14,key_length); int2store(fileinfo+16,reclength); int4store(fileinfo+18,create_info->max_rows); |