mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge maint2.mysql.com:/data/localhome/tsmith/bk/41
into maint2.mysql.com:/data/localhome/tsmith/bk/50
This commit is contained in:
@ -2354,9 +2354,14 @@ print_table_data(MYSQL_RES *result)
|
|||||||
(void) tee_fputs("|", PAGER);
|
(void) tee_fputs("|", PAGER);
|
||||||
for (uint off=0; (field = mysql_fetch_field(result)) ; off++)
|
for (uint off=0; (field = mysql_fetch_field(result)) ; off++)
|
||||||
{
|
{
|
||||||
tee_fprintf(PAGER, " %-*s |",(int) min(field->max_length,
|
uint name_length= (uint) strlen(field->name);
|
||||||
|
uint numcells= charset_info->cset->numcells(charset_info,
|
||||||
|
field->name,
|
||||||
|
field->name + name_length);
|
||||||
|
uint display_length= field->max_length + name_length - numcells;
|
||||||
|
tee_fprintf(PAGER, " %-*s |",(int) min(display_length,
|
||||||
MAX_COLUMN_LENGTH),
|
MAX_COLUMN_LENGTH),
|
||||||
field->name);
|
field->name);
|
||||||
num_flag[off]= IS_NUM(field->type);
|
num_flag[off]= IS_NUM(field->type);
|
||||||
not_null_flag[off]= IS_NOT_NULL(field->flags);
|
not_null_flag[off]= IS_NOT_NULL(field->flags);
|
||||||
}
|
}
|
||||||
|
@ -248,3 +248,14 @@ select rpad(c1,3,'
|
|||||||
rpad(c1,3,'<27>') rpad('<27>',3,c1)
|
rpad(c1,3,'<27>') rpad('<27>',3,c1)
|
||||||
<EFBFBD><EFBFBD><EFBFBD> <09><><EFBFBD>
|
<EFBFBD><EFBFBD><EFBFBD> <09><><EFBFBD>
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
set names koi8r;
|
||||||
|
create table t1(a char character set cp1251 default _koi8r 0xFF);
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`a` char(1) character set cp1251 default '<27>'
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
|
drop table t1;
|
||||||
|
create table t1(a char character set latin1 default _cp1251 0xFF);
|
||||||
|
ERROR 42000: Invalid default value for 'a'
|
||||||
|
End of 4.1 tests
|
||||||
|
@ -924,6 +924,37 @@ NULL
|
|||||||
select ifnull(NULL, _utf8'string');
|
select ifnull(NULL, _utf8'string');
|
||||||
ifnull(NULL, _utf8'string')
|
ifnull(NULL, _utf8'string')
|
||||||
string
|
string
|
||||||
|
set names utf8;
|
||||||
|
create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
|
||||||
|
insert into t1 values ('I'),('K'),('Y');
|
||||||
|
select * from t1 where s1 < 'K' and s1 = 'Y';
|
||||||
|
s1
|
||||||
|
I
|
||||||
|
Y
|
||||||
|
select * from t1 where 'K' > s1 and s1 = 'Y';
|
||||||
|
s1
|
||||||
|
I
|
||||||
|
Y
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
|
||||||
|
insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
|
||||||
|
select * from t1 where s1 > 'd' and s1 = 'CH';
|
||||||
|
s1
|
||||||
|
ch
|
||||||
|
CH
|
||||||
|
Ch
|
||||||
|
select * from t1 where 'd' < s1 and s1 = 'CH';
|
||||||
|
s1
|
||||||
|
ch
|
||||||
|
CH
|
||||||
|
Ch
|
||||||
|
select * from t1 where s1 = 'cH' and s1 <> 'ch';
|
||||||
|
s1
|
||||||
|
cH
|
||||||
|
select * from t1 where 'cH' = s1 and s1 <> 'ch';
|
||||||
|
s1
|
||||||
|
cH
|
||||||
|
drop table t1;
|
||||||
create table t1 (a varchar(255)) default character set utf8;
|
create table t1 (a varchar(255)) default character set utf8;
|
||||||
insert into t1 values (1.0);
|
insert into t1 values (1.0);
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -187,4 +187,16 @@ select rpad(c1,3,'
|
|||||||
#select case c1 when '<27>' then '<27>' when '<27>' then '<27>' else 'c' end from t1;
|
#select case c1 when '<27>' then '<27>' when '<27>' then '<27>' else 'c' end from t1;
|
||||||
#select export_set(5,c1,'<27>'), export_set(5,'<27>',c1) from t1;
|
#select export_set(5,c1,'<27>'), export_set(5,'<27>',c1) from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
# End of 4.1 tests
|
|
||||||
|
#
|
||||||
|
# Bug 20695: problem with field default value's character set
|
||||||
|
#
|
||||||
|
|
||||||
|
set names koi8r;
|
||||||
|
create table t1(a char character set cp1251 default _koi8r 0xFF);
|
||||||
|
show create table t1;
|
||||||
|
drop table t1;
|
||||||
|
--error 1067
|
||||||
|
create table t1(a char character set latin1 default _cp1251 0xFF);
|
||||||
|
|
||||||
|
--echo End of 4.1 tests
|
||||||
|
@ -727,6 +727,24 @@ drop table t1;
|
|||||||
select repeat(_utf8'+',3) as h union select NULL;
|
select repeat(_utf8'+',3) as h union select NULL;
|
||||||
select ifnull(NULL, _utf8'string');
|
select ifnull(NULL, _utf8'string');
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#9509 Optimizer: wrong result after AND with comparisons
|
||||||
|
#
|
||||||
|
set names utf8;
|
||||||
|
create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
|
||||||
|
insert into t1 values ('I'),('K'),('Y');
|
||||||
|
select * from t1 where s1 < 'K' and s1 = 'Y';
|
||||||
|
select * from t1 where 'K' > s1 and s1 = 'Y';
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
|
||||||
|
insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
|
||||||
|
select * from t1 where s1 > 'd' and s1 = 'CH';
|
||||||
|
select * from t1 where 'd' < s1 and s1 = 'CH';
|
||||||
|
select * from t1 where s1 = 'cH' and s1 <> 'ch';
|
||||||
|
select * from t1 where 'cH' = s1 and s1 <> 'ch';
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug#10714: Inserting double value into utf8 column crashes server
|
# Bug#10714: Inserting double value into utf8 column crashes server
|
||||||
#
|
#
|
||||||
|
@ -860,7 +860,7 @@ my_real_read(NET *net, ulong *complen)
|
|||||||
#endif /* EXTRA_DEBUG */
|
#endif /* EXTRA_DEBUG */
|
||||||
}
|
}
|
||||||
#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER)
|
#if defined(THREAD_SAFE_CLIENT) && !defined(MYSQL_SERVER)
|
||||||
if (vio_should_retry(net->vio))
|
if (vio_errno(net->vio) == SOCKET_EINTR)
|
||||||
{
|
{
|
||||||
DBUG_PRINT("warning",("Interrupted read. Retrying..."));
|
DBUG_PRINT("warning",("Interrupted read. Retrying..."));
|
||||||
continue;
|
continue;
|
||||||
|
@ -654,8 +654,9 @@ int MYSQLlex(void *arg, void *yythd)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ((yylval->lex_str.str[0]=='_') &&
|
if ((yylval->lex_str.str[0]=='_') &&
|
||||||
(lex->charset=get_charset_by_csname(yylval->lex_str.str+1,
|
(lex->underscore_charset=
|
||||||
MY_CS_PRIMARY,MYF(0))))
|
get_charset_by_csname(yylval->lex_str.str + 1,
|
||||||
|
MY_CS_PRIMARY,MYF(0))))
|
||||||
return(UNDERSCORE_CHARSET);
|
return(UNDERSCORE_CHARSET);
|
||||||
return(result_state); // IDENT or IDENT_QUOTED
|
return(result_state); // IDENT or IDENT_QUOTED
|
||||||
|
|
||||||
|
@ -834,7 +834,7 @@ typedef struct st_lex : public Query_tables_list
|
|||||||
XID *xid;
|
XID *xid;
|
||||||
gptr yacc_yyss,yacc_yyvs;
|
gptr yacc_yyss,yacc_yyvs;
|
||||||
THD *thd;
|
THD *thd;
|
||||||
CHARSET_INFO *charset;
|
CHARSET_INFO *charset, *underscore_charset;
|
||||||
/* store original leaf_tables for INSERT SELECT and PS/SP */
|
/* store original leaf_tables for INSERT SELECT and PS/SP */
|
||||||
TABLE_LIST *leaf_tables_insert;
|
TABLE_LIST *leaf_tables_insert;
|
||||||
/* Position (first character index) of SELECT of CREATE VIEW statement */
|
/* Position (first character index) of SELECT of CREATE VIEW statement */
|
||||||
|
@ -7210,6 +7210,8 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
|
|||||||
left_item->collation.collation == value->collation.collation))
|
left_item->collation.collation == value->collation.collation))
|
||||||
{
|
{
|
||||||
Item *tmp=value->new_item();
|
Item *tmp=value->new_item();
|
||||||
|
tmp->collation.set(right_item->collation);
|
||||||
|
|
||||||
if (tmp)
|
if (tmp)
|
||||||
{
|
{
|
||||||
thd->change_item_tree(args + 1, tmp);
|
thd->change_item_tree(args + 1, tmp);
|
||||||
@ -7232,6 +7234,8 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
|
|||||||
right_item->collation.collation == value->collation.collation))
|
right_item->collation.collation == value->collation.collation))
|
||||||
{
|
{
|
||||||
Item *tmp=value->new_item();
|
Item *tmp=value->new_item();
|
||||||
|
tmp->collation.set(left_item->collation);
|
||||||
|
|
||||||
if (tmp)
|
if (tmp)
|
||||||
{
|
{
|
||||||
thd->change_item_tree(args, tmp);
|
thd->change_item_tree(args, tmp);
|
||||||
|
@ -715,6 +715,40 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Convert the default value from client character
|
||||||
|
set into the column character set if necessary.
|
||||||
|
*/
|
||||||
|
if (sql_field->def &&
|
||||||
|
save_cs != sql_field->def->collation.collation &&
|
||||||
|
(sql_field->sql_type == FIELD_TYPE_VAR_STRING ||
|
||||||
|
sql_field->sql_type == FIELD_TYPE_STRING ||
|
||||||
|
sql_field->sql_type == FIELD_TYPE_SET ||
|
||||||
|
sql_field->sql_type == FIELD_TYPE_ENUM))
|
||||||
|
{
|
||||||
|
Query_arena backup_arena;
|
||||||
|
bool need_to_change_arena= !thd->stmt_arena->is_conventional();
|
||||||
|
if (need_to_change_arena)
|
||||||
|
{
|
||||||
|
/* Asser that we don't do that at every PS execute */
|
||||||
|
DBUG_ASSERT(thd->stmt_arena->is_first_stmt_execute() ||
|
||||||
|
thd->stmt_arena->is_first_sp_execute());
|
||||||
|
thd->set_n_backup_active_arena(thd->stmt_arena, &backup_arena);
|
||||||
|
}
|
||||||
|
|
||||||
|
sql_field->def= sql_field->def->safe_charset_converter(save_cs);
|
||||||
|
|
||||||
|
if (need_to_change_arena)
|
||||||
|
thd->restore_active_arena(thd->stmt_arena, &backup_arena);
|
||||||
|
|
||||||
|
if (sql_field->def == NULL)
|
||||||
|
{
|
||||||
|
/* Could not convert */
|
||||||
|
my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
|
||||||
|
DBUG_RETURN(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (sql_field->sql_type == FIELD_TYPE_SET ||
|
if (sql_field->sql_type == FIELD_TYPE_SET ||
|
||||||
sql_field->sql_type == FIELD_TYPE_ENUM)
|
sql_field->sql_type == FIELD_TYPE_ENUM)
|
||||||
{
|
{
|
||||||
@ -776,35 +810,6 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
sql_field->interval_list.empty(); // Don't need interval_list anymore
|
sql_field->interval_list.empty(); // Don't need interval_list anymore
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Convert the default value from client character
|
|
||||||
set into the column character set if necessary.
|
|
||||||
*/
|
|
||||||
if (sql_field->def && cs != sql_field->def->collation.collation)
|
|
||||||
{
|
|
||||||
Query_arena backup_arena;
|
|
||||||
bool need_to_change_arena= !thd->stmt_arena->is_conventional();
|
|
||||||
if (need_to_change_arena)
|
|
||||||
{
|
|
||||||
/* Asser that we don't do that at every PS execute */
|
|
||||||
DBUG_ASSERT(thd->stmt_arena->is_first_stmt_execute() ||
|
|
||||||
thd->stmt_arena->is_first_sp_execute());
|
|
||||||
thd->set_n_backup_active_arena(thd->stmt_arena, &backup_arena);
|
|
||||||
}
|
|
||||||
|
|
||||||
sql_field->def= sql_field->def->safe_charset_converter(cs);
|
|
||||||
|
|
||||||
if (need_to_change_arena)
|
|
||||||
thd->restore_active_arena(thd->stmt_arena, &backup_arena);
|
|
||||||
|
|
||||||
if (sql_field->def == NULL)
|
|
||||||
{
|
|
||||||
/* Could not convert */
|
|
||||||
my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
|
|
||||||
DBUG_RETURN(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sql_field->sql_type == FIELD_TYPE_SET)
|
if (sql_field->sql_type == FIELD_TYPE_SET)
|
||||||
{
|
{
|
||||||
uint32 field_length;
|
uint32 field_length;
|
||||||
|
@ -7069,7 +7069,7 @@ text_literal:
|
|||||||
| NCHAR_STRING
|
| NCHAR_STRING
|
||||||
{ $$= new Item_string($1.str,$1.length,national_charset_info); }
|
{ $$= new Item_string($1.str,$1.length,national_charset_info); }
|
||||||
| UNDERSCORE_CHARSET TEXT_STRING
|
| UNDERSCORE_CHARSET TEXT_STRING
|
||||||
{ $$ = new Item_string($2.str,$2.length,Lex->charset); }
|
{ $$ = new Item_string($2.str,$2.length,Lex->underscore_charset); }
|
||||||
| text_literal TEXT_STRING_literal
|
| text_literal TEXT_STRING_literal
|
||||||
{ ((Item_string*) $1)->append($2.str,$2.length); }
|
{ ((Item_string*) $1)->append($2.str,$2.length); }
|
||||||
;
|
;
|
||||||
@ -7147,7 +7147,7 @@ literal:
|
|||||||
(String*) 0;
|
(String*) 0;
|
||||||
$$= new Item_string(str ? str->ptr() : "",
|
$$= new Item_string(str ? str->ptr() : "",
|
||||||
str ? str->length() : 0,
|
str ? str->length() : 0,
|
||||||
Lex->charset);
|
Lex->underscore_charset);
|
||||||
}
|
}
|
||||||
| UNDERSCORE_CHARSET BIN_NUM
|
| UNDERSCORE_CHARSET BIN_NUM
|
||||||
{
|
{
|
||||||
|
@ -379,16 +379,30 @@ my_bool vio_poll_read(Vio *vio,uint timeout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void vio_timeout(Vio *vio __attribute__((unused)),
|
void vio_timeout(Vio *vio, uint which, uint timeout)
|
||||||
uint which __attribute__((unused)),
|
|
||||||
uint timeout __attribute__((unused)))
|
|
||||||
{
|
{
|
||||||
|
/* TODO: some action should be taken if socket timeouts are not supported. */
|
||||||
|
#if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO)
|
||||||
|
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
ulong wait_timeout= (ulong) timeout * 1000;
|
|
||||||
(void) setsockopt(vio->sd, SOL_SOCKET,
|
/* Windows expects time in milliseconds as int. */
|
||||||
which ? SO_SNDTIMEO : SO_RCVTIMEO, (char*) &wait_timeout,
|
int wait_timeout= (int) timeout * 1000;
|
||||||
sizeof(wait_timeout));
|
|
||||||
#endif /* __WIN__ */
|
#else /* ! __WIN__ */
|
||||||
|
|
||||||
|
/* POSIX specifies time as struct timeval. */
|
||||||
|
struct timeval wait_timeout;
|
||||||
|
wait_timeout.tv_sec= timeout;
|
||||||
|
wait_timeout.tv_usec= 0;
|
||||||
|
|
||||||
|
#endif /* ! __WIN__ */
|
||||||
|
|
||||||
|
/* TODO: return value should be checked. */
|
||||||
|
(void) setsockopt(vio->sd, SOL_SOCKET, which ? SO_SNDTIMEO : SO_RCVTIMEO,
|
||||||
|
(char*) &wait_timeout, sizeof(wait_timeout));
|
||||||
|
|
||||||
|
#endif /* defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO) */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user