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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
14ced05e
Commit
14ced05e
authored
Feb 10, 2006
by
aelkin@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG#16217 fix partly backported from 5.0. It is different in mysqlbinlog part.
This changeset is assumed to stay in 4.1.
parent
34abab41
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
3 deletions
+73
-3
client/mysql.cc
client/mysql.cc
+25
-1
mysql-test/r/mysqlbinlog.result
mysql-test/r/mysqlbinlog.result
+18
-1
mysql-test/t/mysqlbinlog.test
mysql-test/t/mysqlbinlog.test
+18
-1
sql/log_event.cc
sql/log_event.cc
+12
-0
No files found.
client/mysql.cc
View file @
14ced05e
...
...
@@ -190,7 +190,7 @@ static int com_quit(String *str,char*),
com_connect
(
String
*
str
,
char
*
),
com_status
(
String
*
str
,
char
*
),
com_use
(
String
*
str
,
char
*
),
com_source
(
String
*
str
,
char
*
),
com_rehash
(
String
*
str
,
char
*
),
com_tee
(
String
*
str
,
char
*
),
com_notee
(
String
*
str
,
char
*
),
com_notee
(
String
*
str
,
char
*
),
com_charset
(
String
*
str
,
char
*
),
com_prompt
(
String
*
str
,
char
*
),
com_delimiter
(
String
*
str
,
char
*
);
#ifdef USE_POPEN
...
...
@@ -263,6 +263,8 @@ static COMMANDS commands[] = {
"Set outfile [to_outfile]. Append everything into given outfile."
},
{
"use"
,
'u'
,
com_use
,
1
,
"Use another database. Takes database name as argument."
},
{
"charset_name"
,
'C'
,
com_charset
,
1
,
"Switch to another charset. Might be needed for processing binlog."
},
/* Get bash-like expansion for some commands */
{
"create table"
,
0
,
0
,
0
,
""
},
{
"create database"
,
0
,
0
,
0
,
""
},
...
...
@@ -1850,6 +1852,28 @@ com_clear(String *buffer,char *line __attribute__((unused)))
return
0
;
}
/* ARGSUSED */
static
int
com_charset
(
String
*
buffer
__attribute__
((
unused
)),
char
*
line
)
{
char
buff
[
256
],
*
param
;
CHARSET_INFO
*
new_cs
;
strmake
(
buff
,
line
,
sizeof
(
buff
)
-
1
);
param
=
get_arg
(
buff
,
0
);
if
(
!
param
||
!*
param
)
{
return
put_info
(
"Usage:
\\
C char_setname | charset charset_name"
,
INFO_ERROR
,
0
);
}
new_cs
=
get_charset_by_csname
(
param
,
MY_CS_PRIMARY
,
MYF
(
MY_WME
));
if
(
new_cs
)
{
charset_info
=
new_cs
;
put_info
(
"Charset changed"
,
INFO_INFO
);
}
else
put_info
(
"Charset is not found"
,
INFO_INFO
);
return
0
;
}
/*
Execute command
...
...
mysql-test/r/mysqlbinlog.result
View file @
14ced05e
...
...
@@ -84,4 +84,21 @@ SET INSERT_ID=1;
use test;
SET TIMESTAMP=1000000000;
insert into t1 values ("Alas");
drop table t1, t2;
flush logs;
create table t3 (f text character set utf8);
create table t4 (f text character set cp932);
flush logs;
rename table t3 to t03, t4 to t04;
select HEX(f) from t03;
HEX(f)
E382BD
select HEX(f) from t3;
HEX(f)
E382BD
select HEX(f) from t04;
HEX(f)
835C
select HEX(f) from t4;
HEX(f)
835C
drop table t1, t2, t03, t04, t3, t4;
mysql-test/t/mysqlbinlog.test
View file @
14ced05e
...
...
@@ -98,7 +98,24 @@ select "--- --position --" as "";
--
replace_result
$MYSQL_TEST_DIR
MYSQL_TEST_DIR
--
exec
$MYSQL_BINLOG
--
short
-
form
--
local
-
load
=
$MYSQL_TEST_DIR
/
var
/
tmp
/
--
read
-
from
-
remote
-
server
--
position
=
27
--
user
=
root
--
host
=
127.0
.
0.1
--
port
=
$MASTER_MYPORT
master
-
bin
.
000002
# Bug#16217 (mysql client did not know how not switch its internal charset)
flush
logs
;
create
table
t3
(
f
text
character
set
utf8
);
create
table
t4
(
f
text
character
set
cp932
);
--
exec
$MYSQL
--
default
-
character
-
set
=
utf8
test
-
e
"insert into t3 values(_utf8'ソ')"
--
exec
$MYSQL
--
default
-
character
-
set
=
cp932
test
-
e
"insert into t4 values(_cp932'\');"
flush
logs
;
rename
table
t3
to
t03
,
t4
to
t04
;
--
exec
$MYSQL_BINLOG
--
short
-
form
$MYSQL_TEST_DIR
/
var
/
log
/
master
-
bin
.
000004
|
$MYSQL
--
default
-
character
-
set
=
utf8
# original and recovered data must be equal
select
HEX
(
f
)
from
t03
;
select
HEX
(
f
)
from
t3
;
select
HEX
(
f
)
from
t04
;
select
HEX
(
f
)
from
t4
;
# clean up
drop
table
t1
,
t2
;
drop
table
t1
,
t2
,
t03
,
t04
,
t3
,
t4
;
# End of 4.1 tests
sql/log_event.cc
View file @
14ced05e
...
...
@@ -949,6 +949,7 @@ Query_log_event::Query_log_event(const char* buf, int event_len,
void
Query_log_event
::
print
(
FILE
*
file
,
bool
short_form
,
char
*
last_db
)
{
char
buff
[
40
],
*
end
;
// Enough for SET TIMESTAMP
const
uint
set_len
=
sizeof
(
"SET ONE_SHOT CHARACTER_SET_CLIENT="
)
-
1
;
if
(
!
short_form
)
{
print_header
(
file
);
...
...
@@ -978,6 +979,17 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db)
my_fwrite
(
file
,
(
byte
*
)
buff
,
(
uint
)
(
end
-
buff
),
MYF
(
MY_NABP
|
MY_WME
));
if
(
flags
&
LOG_EVENT_THREAD_SPECIFIC_F
)
fprintf
(
file
,
"SET @@session.pseudo_thread_id=%lu;
\n
"
,(
ulong
)
thread_id
);
/* charset_name command for mysql client */
if
(
!
strncmp
(
query
,
"SET ONE_SHOT CHARACTER_SET_CLIENT="
,
set_len
))
{
char
*
endptr
;
int
cs_number
=
strtoul
(
query
+
set_len
,
&
endptr
,
10
);
DBUG_ASSERT
(
*
endptr
==
','
);
CHARSET_INFO
*
cs_info
=
get_charset
(
cs_number
,
MYF
(
MY_WME
));
if
(
cs_info
)
{
fprintf
(
file
,
"/*!
\\
C %s */;
\n
"
,
cs_info
->
csname
);
}
}
my_fwrite
(
file
,
(
byte
*
)
query
,
q_len
,
MYF
(
MY_NABP
|
MY_WME
));
fprintf
(
file
,
";
\n
"
);
}
...
...
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