Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
e2f40aa6
Commit
e2f40aa6
authored
Sep 01, 2006
by
tsmith@maint2.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge maint2.mysql.com:/data/localhome/tsmith/bk/41
into maint2.mysql.com:/data/localhome/tsmith/bk/50
parents
9111a9c5
907f5db8
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
147 additions
and
46 deletions
+147
-46
client/mysql.cc
client/mysql.cc
+7
-2
mysql-test/r/ctype_recoding.result
mysql-test/r/ctype_recoding.result
+11
-0
mysql-test/r/ctype_utf8.result
mysql-test/r/ctype_utf8.result
+31
-0
mysql-test/t/ctype_recoding.test
mysql-test/t/ctype_recoding.test
+13
-1
mysql-test/t/ctype_utf8.test
mysql-test/t/ctype_utf8.test
+18
-0
sql/net_serv.cc
sql/net_serv.cc
+1
-1
sql/sql_lex.cc
sql/sql_lex.cc
+3
-2
sql/sql_lex.h
sql/sql_lex.h
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+4
-0
sql/sql_table.cc
sql/sql_table.cc
+34
-29
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-2
vio/viosocket.c
vio/viosocket.c
+22
-8
No files found.
client/mysql.cc
View file @
e2f40aa6
...
...
@@ -2354,7 +2354,12 @@ print_table_data(MYSQL_RES *result)
(
void
)
tee_fputs
(
"|"
,
PAGER
);
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
),
field
->
name
);
num_flag
[
off
]
=
IS_NUM
(
field
->
type
);
...
...
mysql-test/r/ctype_recoding.result
View file @
e2f40aa6
...
...
@@ -248,3 +248,14 @@ select rpad(c1,3,'
rpad(c1,3,'') rpad('',3,c1)
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 ''
) 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
mysql-test/r/ctype_utf8.result
View file @
e2f40aa6
...
...
@@ -924,6 +924,37 @@ NULL
select ifnull(NULL, _utf8'string');
ifnull(NULL, _utf8'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;
insert into t1 values (1.0);
drop table t1;
...
...
mysql-test/t/ctype_recoding.test
View file @
e2f40aa6
...
...
@@ -187,4 +187,16 @@ select rpad(c1,3,'
#select case c1 when '' then '' when '' then '' else 'c' end from t1;
#select export_set(5,c1,''), export_set(5,'',c1) from 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
mysql-test/t/ctype_utf8.test
View file @
e2f40aa6
...
...
@@ -727,6 +727,24 @@ drop table t1;
select
repeat
(
_utf8
'+'
,
3
)
as
h
union
select
NULL
;
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
#
...
...
sql/net_serv.cc
View file @
e2f40aa6
...
...
@@ -860,7 +860,7 @@ my_real_read(NET *net, ulong *complen)
#endif
/* EXTRA_DEBUG */
}
#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..."
));
continue
;
...
...
sql/sql_lex.cc
View file @
e2f40aa6
...
...
@@ -654,7 +654,8 @@ int MYSQLlex(void *arg, void *yythd)
*/
if
((
yylval
->
lex_str
.
str
[
0
]
==
'_'
)
&&
(
lex
->
charset
=
get_charset_by_csname
(
yylval
->
lex_str
.
str
+
1
,
(
lex
->
underscore_charset
=
get_charset_by_csname
(
yylval
->
lex_str
.
str
+
1
,
MY_CS_PRIMARY
,
MYF
(
0
))))
return
(
UNDERSCORE_CHARSET
);
return
(
result_state
);
// IDENT or IDENT_QUOTED
...
...
sql/sql_lex.h
View file @
e2f40aa6
...
...
@@ -834,7 +834,7 @@ typedef struct st_lex : public Query_tables_list
XID
*
xid
;
gptr
yacc_yyss
,
yacc_yyvs
;
THD
*
thd
;
CHARSET_INFO
*
charset
;
CHARSET_INFO
*
charset
,
*
underscore_charset
;
/* store original leaf_tables for INSERT SELECT and PS/SP */
TABLE_LIST
*
leaf_tables_insert
;
/* Position (first character index) of SELECT of CREATE VIEW statement */
...
...
sql/sql_select.cc
View file @
e2f40aa6
...
...
@@ -7210,6 +7210,8 @@ change_cond_ref_to_const(THD *thd, I_List<COND_CMP> *save_list,
left_item
->
collation
.
collation
==
value
->
collation
.
collation
))
{
Item
*
tmp
=
value
->
new_item
();
tmp
->
collation
.
set
(
right_item
->
collation
);
if
(
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
))
{
Item
*
tmp
=
value
->
new_item
();
tmp
->
collation
.
set
(
left_item
->
collation
);
if
(
tmp
)
{
thd
->
change_item_tree
(
args
,
tmp
);
...
...
sql/sql_table.cc
View file @
e2f40aa6
...
...
@@ -715,6 +715,40 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
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
||
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
}
/*
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
)
{
uint32
field_length
;
...
...
sql/sql_yacc.yy
View file @
e2f40aa6
...
...
@@ -7069,7 +7069,7 @@ text_literal:
| NCHAR_STRING
{ $$= new Item_string($1.str,$1.length,national_charset_info); }
| 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
{ ((Item_string*) $1)->append($2.str,$2.length); }
;
...
...
@@ -7147,7 +7147,7 @@ literal:
(String*) 0;
$$= new Item_string(str ? str->ptr() : "",
str ? str->length() : 0,
Lex->charset);
Lex->
underscore_
charset);
}
| UNDERSCORE_CHARSET BIN_NUM
{
...
...
vio/viosocket.c
View file @
e2f40aa6
...
...
@@ -379,16 +379,30 @@ my_bool vio_poll_read(Vio *vio,uint timeout)
}
void
vio_timeout
(
Vio
*
vio
__attribute__
((
unused
)),
uint
which
__attribute__
((
unused
)),
uint
timeout
__attribute__
((
unused
)))
void
vio_timeout
(
Vio
*
vio
,
uint
which
,
uint
timeout
)
{
/* TODO: some action should be taken if socket timeouts are not supported. */
#if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO)
#ifdef __WIN__
ulong
wait_timeout
=
(
ulong
)
timeout
*
1000
;
(
void
)
setsockopt
(
vio
->
sd
,
SOL_SOCKET
,
which
?
SO_SNDTIMEO
:
SO_RCVTIMEO
,
(
char
*
)
&
wait_timeout
,
sizeof
(
wait_timeout
));
#endif
/* __WIN__ */
/* Windows expects time in milliseconds as int. */
int
wait_timeout
=
(
int
)
timeout
*
1000
;
#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) */
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment