diff options
-rw-r--r-- | include/config-netware.h | 5 | ||||
-rw-r--r-- | mysql-test/r/create.result | 11 | ||||
-rw-r--r-- | mysql-test/t/create.test | 8 | ||||
-rw-r--r-- | sql/field.cc | 12 | ||||
-rw-r--r-- | sql/field.h | 5 | ||||
-rw-r--r-- | sql/sql_table.cc | 4 |
6 files changed, 39 insertions, 6 deletions
diff --git a/include/config-netware.h b/include/config-netware.h index 4c46ccd3ec7..7def0053bf2 100644 --- a/include/config-netware.h +++ b/include/config-netware.h @@ -118,15 +118,12 @@ extern "C" { /* do not use the extended time in LibC sys\stat.h */ #define _POSIX_SOURCE -/* Kernel call on NetWare that will only yield if our time slice is up */ -void kYieldIfTimeSliceUp(void); - /* Some macros for portability */ #define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time(NULL)+(SEC); (ABSTIME).tv_nsec=0; } /* extra protection against CPU Hogs on NetWare */ -#define NETWARE_YIELD kYieldIfTimeSliceUp() +#define NETWARE_YIELD pthread_yield() /* Screen mode for help texts */ #define NETWARE_SET_SCREEN_MODE(A) setscreenmode(A) diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 3e7c9d6eb4a..c0c6acd2c70 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -641,3 +641,14 @@ create table if not exists t1 (a int); Warnings: Note 1050 Table 't1' already exists drop table t1; +create table t1 ( +a varchar(112) charset utf8 collate utf8_bin not null, +primary key (a) +) select 'test' as a ; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(112) character set utf8 collate utf8_bin NOT NULL default '', + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index b72dc49e89a..f461a092de1 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -545,4 +545,12 @@ create table t1 (a int); create table if not exists t1 (a int); drop table t1; +# BUG#14139 +create table t1 ( + a varchar(112) charset utf8 collate utf8_bin not null, + primary key (a) +) select 'test' as a ; +show create table t1; +drop table t1; + # End of 4.1 tests diff --git a/sql/field.cc b/sql/field.cc index b4ba89f613c..36b4ec96efa 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -8186,8 +8186,20 @@ void Field_bit_as_char::sql_type(String &res) const Handling of field and create_field *****************************************************************************/ +/* + Convert create_field::length from number of characters to number of bytes + + SYNOPSIS + create_field::create_length_to_internal_length() + + DESCRIPTION + Convert create_field::length from number of characters to number of bytes, + save original value in chars_length. +*/ + void create_field::create_length_to_internal_length(void) { + chars_length= length; switch (sql_type) { case MYSQL_TYPE_TINY_BLOB: case MYSQL_TYPE_MEDIUM_BLOB: diff --git a/sql/field.h b/sql/field.h index a9f47ecc4a9..319316aad15 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1368,6 +1368,11 @@ public: LEX_STRING comment; // Comment for field Item *def; // Default value enum enum_field_types sql_type; + /* + At various stages in execution this can be length of field in bytes or + max number of characters. + */ + ulong length; ulong length; uint decimals, flags, pack_length, key_length; Field::utype unireg_check; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 56a55d9fbc0..b635c44c6dc 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -839,8 +839,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, sql_field->charset= (dup_field->charset ? dup_field->charset : create_info->default_table_charset); - sql_field->length= dup_field->length; - sql_field->pack_length= dup_field->pack_length; + sql_field->length= dup_field->chars_length; + sql_field->pack_length= dup_field->pack_length; sql_field->key_length= dup_field->key_length; sql_field->create_length_to_internal_length(); sql_field->decimals= dup_field->decimals; |