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
d7734fd8
Commit
d7734fd8
authored
Dec 10, 2004
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Plain Diff
Merge sinisa@bk-internal.mysql.com:/home/bk/mysql-4.1
into sinisa.nasamreza.org:/mnt/work/mysql-4.1
parents
5ad7286b
6772f0a7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
2 deletions
+18
-2
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+6
-0
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+8
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+3
-2
sql/item_strfunc.h
sql/item_strfunc.h
+1
-0
No files found.
mysql-test/r/func_str.result
View file @
d7734fd8
...
...
@@ -685,3 +685,9 @@ drop table t1;
select left(1234, 3) + 0;
left(1234, 3) + 0
123
create table t1 (a int not null primary key, b varchar(40), c datetime);
insert into t1 (a,b,c) values (1,'Tom',now()),(2,'ball games',now()), (3,'Basil',now()), (4,'Dean',now()),(5,'Ellis',now()), (6,'Serg',now()), (7,'Sergei',now()),(8,'Georg',now()),(9,'Salle',now()),(10,'Sinisa',now());
select count(*) as total, left(c,10) as reg from t1 group by reg order by reg desc limit 0,12;
total reg
10 2004-12-10
drop table t1;
mysql-test/t/func_str.test
View file @
d7734fd8
...
...
@@ -421,3 +421,11 @@ drop table t1;
#
select
left
(
1234
,
3
)
+
0
;
#
# Bug #7101: bug with LEFT() when used as a field in GROUP BY aggregation
#
create
table
t1
(
a
int
not
null
primary
key
,
b
varchar
(
40
),
c
datetime
);
insert
into
t1
(
a
,
b
,
c
)
values
(
1
,
'Tom'
,
now
()),(
2
,
'ball games'
,
now
()),
(
3
,
'Basil'
,
now
()),
(
4
,
'Dean'
,
now
()),(
5
,
'Ellis'
,
now
()),
(
6
,
'Serg'
,
now
()),
(
7
,
'Sergei'
,
now
()),(
8
,
'Georg'
,
now
()),(
9
,
'Salle'
,
now
()),(
10
,
'Sinisa'
,
now
());
select
count
(
*
)
as
total
,
left
(
c
,
10
)
as
reg
from
t1
group
by
reg
order
by
reg
desc
limit
0
,
12
;
drop
table
t1
;
sql/item_strfunc.cc
View file @
d7734fd8
...
...
@@ -954,8 +954,9 @@ String *Item_func_left::val_str(String *str)
if
(
res
->
length
()
<=
(
uint
)
length
||
res
->
length
()
<=
(
char_pos
=
res
->
charpos
(
length
)))
return
res
;
str_value
.
set
(
*
res
,
0
,
char_pos
);
return
&
str_value
;
tmp_value
.
set
(
*
res
,
0
,
char_pos
);
return
&
tmp_value
;
}
...
...
sql/item_strfunc.h
View file @
d7734fd8
...
...
@@ -162,6 +162,7 @@ public:
class
Item_func_left
:
public
Item_str_func
{
String
tmp_value
;
public:
Item_func_left
(
Item
*
a
,
Item
*
b
)
:
Item_str_func
(
a
,
b
)
{}
String
*
val_str
(
String
*
);
...
...
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