From 67ce24796584e80cf843b37b09aeb794c9231190 Mon Sep 17 00:00:00 2001 From: "monty@mysql.com" <> Date: Mon, 6 Dec 2004 02:00:37 +0200 Subject: Add support for up to VARCHAR (size up to 65535) Renamed HA_VAR_LENGTH to HA_VAR_LENGTH_PART Renamed in all files FIELD_TYPE_STRING and FIELD_TYPE_VAR_STRING to MYSQL_TYPE_STRING and MYSQL_TYPE_VAR_STRING to make it easy to catch all possible errors Added support for VARCHAR KEYS to heap Removed support for ISAM Now only long VARCHAR columns are changed to TEXT on demand (not CHAR) Internal temporary files can now use fixed length tables if the used VARCHAR columns are short --- include/decimal.h | 2 -- include/m_ctype.h | 6 ++++-- include/my_base.h | 10 ++++++++-- include/my_handler.h | 7 +++++++ include/mysql_com.h | 2 +- 5 files changed, 20 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/decimal.h b/include/decimal.h index 5b5b8c0b460..243322e0333 100644 --- a/include/decimal.h +++ b/include/decimal.h @@ -17,8 +17,6 @@ #ifndef _decimal_h #define _decimal_h -#include - typedef enum {TRUNCATE=0, HALF_EVEN, HALF_UP, CEILING, FLOOR} decimal_round_mode; typedef int32 decimal_digit; diff --git a/include/m_ctype.h b/include/m_ctype.h index ddc21070547..ac4cfc0fbba 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -106,7 +106,8 @@ typedef struct my_collation_handler_st int (*strnncoll)(struct charset_info_st *, const uchar *, uint, const uchar *, uint, my_bool); int (*strnncollsp)(struct charset_info_st *, - const uchar *, uint, const uchar *, uint); + const uchar *, uint, const uchar *, uint, + my_bool diff_if_only_endspace_difference); int (*strnxfrm)(struct charset_info_st *, uchar *, uint, const uchar *, uint); my_bool (*like_range)(struct charset_info_st *, @@ -259,7 +260,8 @@ extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, uint, const uchar *, uint, my_bool); extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, uint, - const uchar *, uint); + const uchar *, uint, + my_bool diff_if_only_endspace_difference); extern void my_hash_sort_simple(CHARSET_INFO *cs, const uchar *key, uint len, diff --git a/include/my_base.h b/include/my_base.h index 815a1c76c0e..88d3ec0b270 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -213,7 +213,7 @@ enum ha_base_keytype { /* Key has a part that can have end space. If this is an unique key we have to handle it differently from other unique keys as we can find - many matching rows for one key (becaue end space are not compared) + many matching rows for one key (because end space are not compared) */ #define HA_END_SPACE_KEY 4096 @@ -221,12 +221,17 @@ enum ha_base_keytype { #define HA_SPACE_PACK 1 /* Pack space in key-seg */ #define HA_PART_KEY_SEG 4 /* Used by MySQL for part-key-cols */ -#define HA_VAR_LENGTH 8 +#define HA_VAR_LENGTH_PART 8 #define HA_NULL_PART 16 #define HA_BLOB_PART 32 #define HA_SWAP_KEY 64 #define HA_REVERSE_SORT 128 /* Sort key in reverse order */ #define HA_NO_SORT 256 /* do not bother sorting on this keyseg */ +/* + End space in unique/varchar are considered equal. (Like 'a' and 'a ') + Only needed for internal temporary tables. +*/ +#define HA_END_SPACE_ARE_EQUAL 512 /* optionbits for database */ #define HA_OPTION_PACK_RECORD 1 @@ -345,6 +350,7 @@ enum ha_base_keytype { #define HA_STATE_BUFF_SAVED 512 /* If current keybuff is info->buff */ #define HA_STATE_ROW_CHANGED 1024 /* To invalide ROW cache */ #define HA_STATE_EXTEND_BLOCK 2048 +#define HA_STATE_RNEXT_SAME 4096 /* rnext_same was called */ enum en_fieldtype { FIELD_LAST=-1,FIELD_NORMAL,FIELD_SKIP_ENDSPACE,FIELD_SKIP_PRESPACE, diff --git a/include/my_handler.h b/include/my_handler.h index 18a6234d3f6..d81c4590f8e 100644 --- a/include/my_handler.h +++ b/include/my_handler.h @@ -57,6 +57,13 @@ typedef struct st_HA_KEYSEG /* Key-portion */ { length=mi_uint2korr((key)+1); (key)+=3; length_pack=3; } \ } +#define store_key_length_inc(key,length) \ +{ if ((length) < 255) \ + { *(key)++=(length); } \ + else \ + { *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \ +} + extern int mi_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint , my_bool, my_bool); extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a, diff --git a/include/mysql_com.h b/include/mysql_com.h index 92a67ac0279..6a03fe90eb5 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -209,7 +209,7 @@ enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY, MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24, MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR, - MYSQL_TYPE_NEWDATE, + MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR, MYSQL_TYPE_ENUM=247, MYSQL_TYPE_SET=248, MYSQL_TYPE_TINY_BLOB=249, -- cgit v1.2.1