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
0980627f
Commit
0980627f
authored
Nov 04, 2016
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix: Item_func_weight_string::print()
parent
232dc91b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
5 deletions
+33
-5
mysql-test/r/ctype_binary.result
mysql-test/r/ctype_binary.result
+1
-1
mysql-test/r/func_weight_string.result
mysql-test/r/func_weight_string.result
+9
-4
mysql-test/t/func_weight_string.test
mysql-test/t/func_weight_string.test
+7
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+15
-0
sql/item_strfunc.h
sql/item_strfunc.h
+1
-0
No files found.
mysql-test/r/ctype_binary.result
View file @
0980627f
...
...
@@ -3145,7 +3145,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE WEIGHT_STRING(a)='a' AND a='a';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (weight_string(`test`.`t1`.`a`) = 'a'))
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 'a') and (weight_string(`test`.`t1`.`a`
,0,0,1
) = 'a'))
DROP TABLE t1;
#
# End of 10.1 tests
...
...
mysql-test/r/func_weight_string.result
View file @
0980627f
...
...
@@ -119,7 +119,7 @@ SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and isnull(weight_string(`test`.`t1`.`a`)))
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and isnull(weight_string(`test`.`t1`.`a`
,0,0,1
)))
ALTER TABLE t1 MODIFY a DOUBLE ZEROFILL;
SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
a
...
...
@@ -129,7 +129,7 @@ SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and isnull(weight_string(`test`.`t1`.`a`)))
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and isnull(weight_string(`test`.`t1`.`a`
,0,0,1
)))
ALTER TABLE t1 MODIFY a DECIMAL(10,1) ZEROFILL;
SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
a
...
...
@@ -139,7 +139,7 @@ SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and isnull(weight_string(`test`.`t1`.`a`)))
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = 1) and isnull(weight_string(`test`.`t1`.`a`
,0,0,1
)))
DROP TABLE t1;
#
# End of 10.1 tests
...
...
@@ -155,13 +155,18 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(10) DEFAULT NULL,
`b` varbinary(10) DEFAULT
WEIGHT_STRING(a AS CHAR(10)
)
`b` varbinary(10) DEFAULT
weight_string(`a`,0,10,65
)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 (a) VALUES ('a');
SELECT a, HEX(b) FROM t1;
a HEX(b)
a 41202020202020202020
DROP TABLE t1;
create view v1 as select weight_string("MySQL" as char(4));
select * from v1;
weight_string("MySQL" as char(4))
MYSQ
drop view v1;
#
# End of 10.2 tests
#
mysql-test/t/func_weight_string.test
View file @
0980627f
...
...
@@ -161,6 +161,13 @@ INSERT INTO t1 (a) VALUES ('a');
SELECT
a
,
HEX
(
b
)
FROM
t1
;
DROP
TABLE
t1
;
#
# Item_func_weight_string::print()
#
create
view
v1
as
select
weight_string
(
"MySQL"
as
char
(
4
));
select
*
from
v1
;
drop
view
v1
;
--
echo
#
--
echo
# End of 10.2 tests
--
echo
#
sql/item_strfunc.cc
View file @
0980627f
...
...
@@ -3621,6 +3621,21 @@ String *Item_func_weight_string::val_str(String *str)
}
void
Item_func_weight_string
::
print
(
String
*
str
,
enum_query_type
query_type
)
{
str
->
append
(
func_name
());
str
->
append
(
'('
);
args
[
0
]
->
print
(
str
,
query_type
);
str
->
append
(
','
);
str
->
append_ulonglong
(
result_length
);
str
->
append
(
','
);
str
->
append_ulonglong
(
nweights
);
str
->
append
(
','
);
str
->
append_ulonglong
(
flags
);
str
->
append
(
')'
);
}
String
*
Item_func_hex
::
val_str_ascii
(
String
*
str
)
{
String
*
res
;
...
...
sql/item_strfunc.h
View file @
0980627f
...
...
@@ -1254,6 +1254,7 @@ class Item_func_weight_string :public Item_str_func
}
Item
*
propagate_equal_fields
(
THD
*
thd
,
const
Context
&
ctx
,
COND_EQUAL
*
cond
)
{
return
this
;
}
void
print
(
String
*
str
,
enum_query_type
query_type
);
Item
*
get_copy
(
THD
*
thd
,
MEM_ROOT
*
mem_root
)
{
return
get_item_copy
<
Item_func_weight_string
>
(
thd
,
mem_root
,
this
);
}
};
...
...
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