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
1755df76
Commit
1755df76
authored
Jul 13, 2005
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A fix and a test case for Bug#9379 (collation of a parameter marker is
binary).
parent
2ba35914
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
1 deletion
+52
-1
mysql-test/r/ps.result
mysql-test/r/ps.result
+19
-0
mysql-test/t/ps.test
mysql-test/t/ps.test
+16
-0
sql/item.cc
sql/item.cc
+3
-0
sql/item_func.cc
sql/item_func.cc
+14
-1
No files found.
mysql-test/r/ps.result
View file @
1755df76
...
@@ -622,3 +622,22 @@ execute stmt using @user_id, @id;
...
@@ -622,3 +622,22 @@ execute stmt using @user_id, @id;
partner_id
partner_id
deallocate prepare stmt;
deallocate prepare stmt;
drop table t1, t2, t3, t4;
drop table t1, t2, t3, t4;
prepare stmt from 'select ?=?';
set @a='CHRISTINE ';
set @b='CHRISTINE';
execute stmt using @a, @b;
?=?
1
execute stmt using @a, @b;
?=?
1
set @a=1, @b=2;
execute stmt using @a, @b;
?=?
0
set @a='CHRISTINE ';
set @b='CHRISTINE';
execute stmt using @a, @b;
?=?
1
deallocate prepare stmt;
mysql-test/t/ps.test
View file @
1755df76
...
@@ -650,3 +650,19 @@ execute stmt using @user_id, @id;
...
@@ -650,3 +650,19 @@ execute stmt using @user_id, @id;
execute
stmt
using
@
user_id
,
@
id
;
execute
stmt
using
@
user_id
,
@
id
;
deallocate
prepare
stmt
;
deallocate
prepare
stmt
;
drop
table
t1
,
t2
,
t3
,
t4
;
drop
table
t1
,
t2
,
t3
,
t4
;
#
# Bug#9379: make sure that Item::collation is reset when one sets
# a parameter marker from a string variable.
#
prepare
stmt
from
'select ?=?'
;
set
@
a
=
'CHRISTINE '
;
set
@
b
=
'CHRISTINE'
;
execute
stmt
using
@
a
,
@
b
;
execute
stmt
using
@
a
,
@
b
;
set
@
a
=
1
,
@
b
=
2
;
execute
stmt
using
@
a
,
@
b
;
set
@
a
=
'CHRISTINE '
;
set
@
b
=
'CHRISTINE'
;
execute
stmt
using
@
a
,
@
b
;
deallocate
prepare
stmt
;
sql/item.cc
View file @
1755df76
...
@@ -1089,6 +1089,7 @@ void Item_param::reset()
...
@@ -1089,6 +1089,7 @@ void Item_param::reset()
to the binary log.
to the binary log.
*/
*/
str_value
.
set_charset
(
&
my_charset_bin
);
str_value
.
set_charset
(
&
my_charset_bin
);
collation
.
set
(
&
my_charset_bin
,
DERIVATION_COERCIBLE
);
state
=
NO_VALUE
;
state
=
NO_VALUE
;
maybe_null
=
1
;
maybe_null
=
1
;
null_value
=
0
;
null_value
=
0
;
...
@@ -1336,6 +1337,8 @@ bool Item_param::convert_str_value(THD *thd)
...
@@ -1336,6 +1337,8 @@ bool Item_param::convert_str_value(THD *thd)
*/
*/
str_value_ptr
.
set
(
str_value
.
ptr
(),
str_value
.
length
(),
str_value_ptr
.
set
(
str_value
.
ptr
(),
str_value
.
length
(),
str_value
.
charset
());
str_value
.
charset
());
/* Synchronize item charset with value charset */
collation
.
set
(
str_value
.
charset
(),
DERIVATION_COERCIBLE
);
}
}
return
rc
;
return
rc
;
}
}
...
...
sql/item_func.cc
View file @
1755df76
...
@@ -188,7 +188,20 @@ bool Item_func::agg_arg_charsets(DTCollation &coll,
...
@@ -188,7 +188,20 @@ bool Item_func::agg_arg_charsets(DTCollation &coll,
break
;
// we cannot return here, we need to restore "arena".
break
;
// we cannot return here, we need to restore "arena".
}
}
conv
->
fix_fields
(
thd
,
0
,
&
conv
);
conv
->
fix_fields
(
thd
,
0
,
&
conv
);
/*
If in statement prepare, then we create a converter for two
constant items, do it once and then reuse it.
If we're in execution of a prepared statement, arena is NULL,
and the conv was created in runtime memory. This can be
the case only if the argument is a parameter marker ('?'),
because for all true constants the charset converter has already
been created in prepare. In this case register the change for
rollback.
*/
if
(
arena
)
*
arg
=
conv
;
*
arg
=
conv
;
else
thd
->
change_item_tree
(
arg
,
conv
);
}
}
if
(
arena
)
if
(
arena
)
thd
->
restore_backup_item_arena
(
arena
,
&
backup
);
thd
->
restore_backup_item_arena
(
arena
,
&
backup
);
...
...
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