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
3c5a3258
Commit
3c5a3258
authored
Dec 23, 2004
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for a bug #7495
parent
e409ebf1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
25 deletions
+15
-25
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+6
-12
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+2
-6
sql/item_strfunc.cc
sql/item_strfunc.cc
+7
-7
No files found.
mysql-test/r/func_str.result
View file @
3c5a3258
...
@@ -291,15 +291,9 @@ trim(trailing 'foo' from 'foo')
...
@@ -291,15 +291,9 @@ trim(trailing 'foo' from 'foo')
select trim(leading 'foo' from 'foo');
select trim(leading 'foo' from 'foo');
trim(leading 'foo' from 'foo')
trim(leading 'foo' from 'foo')
create table t1 (a varchar(80), b varchar(80));
select quote(ltrim(concat(' ', 'a')));
insert into t1 values(NULL,"12345");
quote(ltrim(concat(' ', 'a')))
insert into t1 values(NULL,"chm");
'a'
select quote(ltrim(concat(' ',t1.b))) from t1;
select quote(trim(concat(' ', 'a')));
quote(ltrim(concat(' ',t1.b)))
quote(trim(concat(' ', 'a')))
'12345'
'a'
'chm'
select quote(trim(concat(' ',t1.b))) from t1;
quote(trim(concat(' ',t1.b)))
'12345'
'chm'
drop table t1;
mysql-test/t/func_str.test
View file @
3c5a3258
...
@@ -191,9 +191,5 @@ select trim(leading 'foo' from 'foo');
...
@@ -191,9 +191,5 @@ select trim(leading 'foo' from 'foo');
# Bug #7495
# Bug #7495
#
#
create
table
t1
(
a
varchar
(
80
),
b
varchar
(
80
));
select
quote
(
ltrim
(
concat
(
' '
,
'a'
)));
insert
into
t1
values
(
NULL
,
"12345"
);
select
quote
(
trim
(
concat
(
' '
,
'a'
)));
insert
into
t1
values
(
NULL
,
"chm"
);
select
quote
(
ltrim
(
concat
(
' '
,
t1
.
b
)))
from
t1
;
select
quote
(
trim
(
concat
(
' '
,
t1
.
b
)))
from
t1
;
drop
table
t1
;
sql/item_strfunc.cc
View file @
3c5a3258
...
@@ -1141,7 +1141,7 @@ String *Item_func_ltrim::val_str(String *str)
...
@@ -1141,7 +1141,7 @@ String *Item_func_ltrim::val_str(String *str)
}
}
if
(
ptr
==
res
->
ptr
())
if
(
ptr
==
res
->
ptr
())
return
res
;
return
res
;
tmp_value
.
copy
(
res
->
ptr
()
+
(
ptr
-
res
->
ptr
()),
(
uint32
)
(
end
-
ptr
));
tmp_value
.
set
(
*
res
,(
uint
)
(
ptr
-
res
->
ptr
()),(
uint
)
(
end
-
ptr
));
return
&
tmp_value
;
return
&
tmp_value
;
}
}
...
@@ -1266,7 +1266,7 @@ String *Item_func_trim::val_str(String *str)
...
@@ -1266,7 +1266,7 @@ String *Item_func_trim::val_str(String *str)
}
}
if
(
ptr
==
res
->
ptr
()
&&
end
==
ptr
+
res
->
length
())
if
(
ptr
==
res
->
ptr
()
&&
end
==
ptr
+
res
->
length
())
return
res
;
return
res
;
tmp_value
.
copy
(
res
->
ptr
()
+
(
ptr
-
res
->
ptr
()),
(
uint32
)
(
end
-
ptr
));
tmp_value
.
set
(
*
res
,(
uint
)
(
ptr
-
res
->
ptr
()),(
uint
)
(
end
-
ptr
));
return
&
tmp_value
;
return
&
tmp_value
;
}
}
...
@@ -2185,16 +2185,16 @@ String *Item_func_quote::val_str(String *str)
...
@@ -2185,16 +2185,16 @@ String *Item_func_quote::val_str(String *str)
/*
/*
We have to use realloc() instead of alloc() as we want to keep the
We have to use realloc() instead of alloc() as we want to keep the
old result in
str
old result in
arg
*/
*/
if
(
str
->
realloc
(
new_length
))
if
(
arg
->
realloc
(
new_length
))
goto
null
;
goto
null
;
/*
/*
As 'arg' and 'str' may be the same string, we must replace characters
As 'arg' and 'str' may be the same string, we must replace characters
from the end to the beginning
from the end to the beginning
*/
*/
to
=
(
char
*
)
str
->
ptr
()
+
new_length
-
1
;
to
=
(
char
*
)
arg
->
ptr
()
+
new_length
-
1
;
*
to
--=
'\''
;
*
to
--=
'\''
;
for
(
start
=
(
char
*
)
arg
->
ptr
(),
end
=
start
+
arg_length
;
end
--
!=
start
;
to
--
)
for
(
start
=
(
char
*
)
arg
->
ptr
(),
end
=
start
+
arg_length
;
end
--
!=
start
;
to
--
)
{
{
...
@@ -2222,9 +2222,9 @@ String *Item_func_quote::val_str(String *str)
...
@@ -2222,9 +2222,9 @@ String *Item_func_quote::val_str(String *str)
}
}
}
}
*
to
=
'\''
;
*
to
=
'\''
;
str
->
length
(
new_length
);
arg
->
length
(
new_length
);
null_value
=
0
;
null_value
=
0
;
return
str
;
return
arg
;
null:
null:
null_value
=
1
;
null_value
=
1
;
...
...
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