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
d1c109ef
Commit
d1c109ef
authored
Jul 19, 2006
by
igor@olga.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge olga.mysql.com:/home/igor/mysql-4.1-opt
into olga.mysql.com:/home/igor/mysql-5.0-opt
parents
ed8eb314
f201828d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
0 deletions
+64
-0
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+28
-0
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+15
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+17
-0
sql/item_strfunc.h
sql/item_strfunc.h
+4
-0
No files found.
mysql-test/r/func_str.result
View file @
d1c109ef
...
...
@@ -1053,6 +1053,34 @@ a c
abc abc abc
xyz xyz xyz
DROP TABLE t1;
CREATE TABLE t1 (s varchar(10));
INSERT INTO t1 VALUES ('yadda'), ('yaddy');
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(s) > 'ab';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
Warnings:
Note 1003 select test.t1.s AS `s` from test.t1 where (trim(test.t1.s) > _latin1'ab')
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM('y' FROM s) > 'ab';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
Warnings:
Note 1003 select test.t1.s AS `s` from test.t1 where (trim(both _latin1'y' from test.t1.s) > _latin1'ab')
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(LEADING 'y' FROM s) > 'ab';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
Warnings:
Note 1003 select test.t1.s AS `s` from test.t1 where (trim(leading _latin1'y' from test.t1.s) > _latin1'ab')
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(TRAILING 'y' FROM s) > 'ab';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
Warnings:
Note 1003 select test.t1.s AS `s` from test.t1 where (trim(trailing _latin1'y' from test.t1.s) > _latin1'ab')
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(BOTH 'y' FROM s) > 'ab';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
Warnings:
Note 1003 select test.t1.s AS `s` from test.t1 where (trim(both _latin1'y' from test.t1.s) > _latin1'ab')
DROP TABLE t1;
End of 4.1 tests
create table t1 (d decimal default null);
insert into t1 values (null);
...
...
mysql-test/t/func_str.test
View file @
d1c109ef
...
...
@@ -702,6 +702,21 @@ SELECT a, CONCAT(a,' ',a) AS c FROM t1
DROP
TABLE
t1
;
#
# Bug#17526: WRONG PRINT for TRIM FUNCTION with two arguments
#
CREATE
TABLE
t1
(
s
varchar
(
10
));
INSERT
INTO
t1
VALUES
(
'yadda'
),
(
'yaddy'
);
EXPLAIN
EXTENDED
SELECT
s
FROM
t1
WHERE
TRIM
(
s
)
>
'ab'
;
EXPLAIN
EXTENDED
SELECT
s
FROM
t1
WHERE
TRIM
(
'y'
FROM
s
)
>
'ab'
;
EXPLAIN
EXTENDED
SELECT
s
FROM
t1
WHERE
TRIM
(
LEADING
'y'
FROM
s
)
>
'ab'
;
EXPLAIN
EXTENDED
SELECT
s
FROM
t1
WHERE
TRIM
(
TRAILING
'y'
FROM
s
)
>
'ab'
;
EXPLAIN
EXTENDED
SELECT
s
FROM
t1
WHERE
TRIM
(
BOTH
'y'
FROM
s
)
>
'ab'
;
DROP
TABLE
t1
;
--
echo
End
of
4.1
tests
#
...
...
sql/item_strfunc.cc
View file @
d1c109ef
...
...
@@ -1503,6 +1503,23 @@ void Item_func_trim::fix_length_and_dec()
}
}
void
Item_func_trim
::
print
(
String
*
str
)
{
if
(
arg_count
==
1
)
{
Item_func
::
print
(
str
);
return
;
}
str
->
append
(
Item_func_trim
::
func_name
());
str
->
append
(
'('
);
str
->
append
(
mode_name
());
str
->
append
(
' '
);
args
[
1
]
->
print
(
str
);
str
->
append
(
" from "
,
6
);
args
[
0
]
->
print
(
str
);
str
->
append
(
')'
);
}
/* Item_func_password */
...
...
sql/item_strfunc.h
View file @
d1c109ef
...
...
@@ -233,6 +233,8 @@ class Item_func_trim :public Item_str_func
String
*
val_str
(
String
*
);
void
fix_length_and_dec
();
const
char
*
func_name
()
const
{
return
"trim"
;
}
void
print
(
String
*
str
);
virtual
const
char
*
mode_name
()
const
{
return
"both"
;
}
};
...
...
@@ -243,6 +245,7 @@ class Item_func_ltrim :public Item_func_trim
Item_func_ltrim
(
Item
*
a
)
:
Item_func_trim
(
a
)
{}
String
*
val_str
(
String
*
);
const
char
*
func_name
()
const
{
return
"ltrim"
;
}
const
char
*
mode_name
()
const
{
return
"leading"
;
}
};
...
...
@@ -253,6 +256,7 @@ class Item_func_rtrim :public Item_func_trim
Item_func_rtrim
(
Item
*
a
)
:
Item_func_trim
(
a
)
{}
String
*
val_str
(
String
*
);
const
char
*
func_name
()
const
{
return
"rtrim"
;
}
const
char
*
mode_name
()
const
{
return
"trailing"
;
}
};
...
...
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