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
75834b6e
Commit
75834b6e
authored
Mar 21, 2006
by
mats@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/bkroot/mysql-5.0
into mysql.com:/home/bk/b18293-mysql-5.1-new
parents
c9d4d6aa
7351d356
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
23 deletions
+62
-23
mysql-test/extra/binlog_tests/ctype_cp932_binlog.test
mysql-test/extra/binlog_tests/ctype_cp932_binlog.test
+23
-0
sql/item.cc
sql/item.cc
+1
-18
sql/log_event.cc
sql/log_event.cc
+31
-0
sql/mysql_priv.h
sql/mysql_priv.h
+2
-0
sql/sp_head.cc
sql/sp_head.cc
+5
-5
No files found.
mysql-test/extra/binlog_tests/ctype_cp932_binlog.test
View file @
75834b6e
...
@@ -34,3 +34,26 @@ DROP table t1;
...
@@ -34,3 +34,26 @@ DROP table t1;
# end test for bug#11338
# end test for bug#11338
# End of 4.1 tests
# End of 4.1 tests
#
# Bug#18293: Values in stored procedure written to binlog unescaped
#
delimiter
|
;
CREATE
TABLE
t4
(
s1
CHAR
(
50
)
CHARACTER
SET
latin1
,
s2
CHAR
(
50
)
CHARACTER
SET
cp932
,
d
DECIMAL
(
10
,
2
))
|
CREATE
PROCEDURE
bug18293
(
IN
ins1
CHAR
(
50
),
IN
ins2
CHAR
(
50
)
CHARACTER
SET
cp932
,
IN
ind
DECIMAL
(
10
,
2
))
BEGIN
INSERT
INTO
t4
VALUES
(
ins1
,
ins2
,
ind
);
END
|
CALL
bug18293
(
"Foo's a Bar"
,
_cp932
0xED40ED41ED42
,
47.93
)
|
SELECT
HEX
(
s1
),
HEX
(
s2
),
d
FROM
t4
|
DROP
PROCEDURE
bug18293
|
DROP
TABLE
t4
|
SHOW
BINLOG
EVENTS
FROM
393
|
delimiter
;
|
# End of 5.0 tests
sql/item.cc
View file @
75834b6e
...
@@ -2646,25 +2646,8 @@ const String *Item_param::query_val_str(String* str) const
...
@@ -2646,25 +2646,8 @@ const String *Item_param::query_val_str(String* str) const
case
STRING_VALUE
:
case
STRING_VALUE
:
case
LONG_DATA_VALUE
:
case
LONG_DATA_VALUE
:
{
{
char
*
buf
,
*
ptr
;
str
->
length
(
0
);
str
->
length
(
0
);
if
(
str
->
reserve
(
str_value
.
length
()
*
2
+
3
))
append_query_string
(
value
.
cs_info
.
character_set_client
,
&
str_value
,
str
);
break
;
buf
=
str
->
c_ptr_quick
();
ptr
=
buf
;
if
(
value
.
cs_info
.
character_set_client
->
escape_with_backslash_is_dangerous
)
{
ptr
=
str_to_hex
(
ptr
,
str_value
.
ptr
(),
str_value
.
length
());
}
else
{
*
ptr
++=
'\''
;
ptr
+=
escape_string_for_mysql
(
str_value
.
charset
(),
ptr
,
0
,
str_value
.
ptr
(),
str_value
.
length
());
*
ptr
++=
'\''
;
}
str
->
length
((
uint32
)
(
ptr
-
buf
));
break
;
break
;
}
}
case
NULL_VALUE
:
case
NULL_VALUE
:
...
...
sql/log_event.cc
View file @
75834b6e
...
@@ -256,6 +256,37 @@ char *str_to_hex(char *to, const char *from, uint len)
...
@@ -256,6 +256,37 @@ char *str_to_hex(char *to, const char *from, uint len)
return
to
;
// pointer to end 0 of 'to'
return
to
;
// pointer to end 0 of 'to'
}
}
/*
Append a version of the 'from' string suitable for use in a query to
the 'to' string. To generate a correct escaping, the character set
information in 'csinfo' is used.
*/
#ifndef MYSQL_CLIENT
int
append_query_string
(
CHARSET_INFO
*
csinfo
,
String
const
*
from
,
String
*
to
)
{
char
*
beg
,
*
ptr
;
uint32
const
orig_len
=
to
->
length
();
if
(
to
->
reserve
(
orig_len
+
from
->
length
()
*
2
+
3
))
return
1
;
beg
=
to
->
c_ptr_quick
()
+
to
->
length
();
ptr
=
beg
;
if
(
csinfo
->
escape_with_backslash_is_dangerous
)
ptr
=
str_to_hex
(
ptr
,
from
->
ptr
(),
from
->
length
());
else
{
*
ptr
++=
'\''
;
ptr
+=
escape_string_for_mysql
(
from
->
charset
(),
ptr
,
0
,
from
->
ptr
(),
from
->
length
());
*
ptr
++=
'\''
;
}
to
->
length
(
orig_len
+
ptr
-
beg
);
return
0
;
}
#endif
/*
/*
Prints a "session_var=value" string. Used by mysqlbinlog to print some SET
Prints a "session_var=value" string. Used by mysqlbinlog to print some SET
commands just before it prints a query.
commands just before it prints a query.
...
...
sql/mysql_priv.h
View file @
75834b6e
...
@@ -547,6 +547,8 @@ bool delete_precheck(THD *thd, TABLE_LIST *tables);
...
@@ -547,6 +547,8 @@ bool delete_precheck(THD *thd, TABLE_LIST *tables);
bool
insert_precheck
(
THD
*
thd
,
TABLE_LIST
*
tables
);
bool
insert_precheck
(
THD
*
thd
,
TABLE_LIST
*
tables
);
bool
create_table_precheck
(
THD
*
thd
,
TABLE_LIST
*
tables
,
bool
create_table_precheck
(
THD
*
thd
,
TABLE_LIST
*
tables
,
TABLE_LIST
*
create_table
);
TABLE_LIST
*
create_table
);
int
append_query_string
(
CHARSET_INFO
*
csinfo
,
String
const
*
from
,
String
*
to
);
void
get_default_definer
(
THD
*
thd
,
LEX_USER
*
definer
);
void
get_default_definer
(
THD
*
thd
,
LEX_USER
*
definer
);
LEX_USER
*
create_default_definer
(
THD
*
thd
);
LEX_USER
*
create_default_definer
(
THD
*
thd
);
...
...
sql/sp_head.cc
View file @
75834b6e
...
@@ -80,8 +80,8 @@ sp_map_item_type(enum enum_field_types type)
...
@@ -80,8 +80,8 @@ sp_map_item_type(enum enum_field_types type)
/*
/*
Return a string representation of the Item value.
Return a string representation of the Item value.
NOTE:
this is a legacy-compatible implementation. It fails if the value
NOTE:
If the item has a string result type, the string is escaped
contains non-ordinary symbols, which should be escaped
.
according to its character set
.
SYNOPSIS
SYNOPSIS
item a pointer to the Item
item a pointer to the Item
...
@@ -119,9 +119,9 @@ sp_get_item_value(Item *item, String *str)
...
@@ -119,9 +119,9 @@ sp_get_item_value(Item *item, String *str)
buf
.
append
(
'_'
);
buf
.
append
(
'_'
);
buf
.
append
(
result
->
charset
()
->
csname
);
buf
.
append
(
result
->
charset
()
->
csname
);
buf
.
append
(
'\''
);
if
(
result
->
charset
()
->
escape_with_backslash_is_dangerous
)
buf
.
append
(
*
result
);
buf
.
append
(
' '
);
buf
.
append
(
'\''
);
append_query_string
(
result
->
charset
(),
result
,
&
buf
);
str
->
copy
(
buf
);
str
->
copy
(
buf
);
return
str
;
return
str
;
...
...
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