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
1d89bca0
Commit
1d89bca0
authored
Jul 06, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge
mysql-test/r/func_str.result: SCCS merged mysql-test/t/func_str.test: SCCS merged
parents
644d1dbe
ec9c3515
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
1 deletion
+26
-1
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+15
-0
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+9
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+2
-1
No files found.
mysql-test/r/func_str.result
View file @
1d89bca0
...
...
@@ -850,3 +850,18 @@ trackname artistname
April In Paris Vernon Duke Vernon Duke
Autumn In New York NULL
DROP TABLE t1,t2,t3;
create table t1 (b varchar(5));
insert t1 values ('ab'), ('abc'), ('abcd'), ('abcde');
select *,substring(b,1),substring(b,-1),substring(b,-2),substring(b,-3),substring(b,-4),substring(b,-5) from t1;
b substring(b,1) substring(b,-1) substring(b,-2) substring(b,-3) substring(b,-4) substring(b,-5)
ab ab b ab
abc abc c bc abc
abcd abcd d cd bcd abcd
abcde abcde e de cde bcde abcde
select * from (select *,substring(b,1),substring(b,-1),substring(b,-2),substring(b,-3),substring(b,-4),substring(b,-5) from t1) t;
b substring(b,1) substring(b,-1) substring(b,-2) substring(b,-3) substring(b,-4) substring(b,-5)
ab ab b ab
abc abc c bc abc
abcd abcd d cd bcd abcd
abcde abcde e de cde bcde abcde
drop table t1;
mysql-test/t/func_str.test
View file @
1d89bca0
...
...
@@ -597,3 +597,12 @@ SELECT CONCAT_WS(' ', trackname, artistname) trackname, artistname
WHERE
CONCAT_WS
(
' '
,
trackname
,
artistname
)
LIKE
'%In%'
;
DROP
TABLE
t1
,
t2
,
t3
;
#
# Correct length reporting from substring() (BUG#10269)
#
create
table
t1
(
b
varchar
(
5
));
insert
t1
values
(
'ab'
),
(
'abc'
),
(
'abcd'
),
(
'abcde'
);
select
*
,
substring
(
b
,
1
),
substring
(
b
,
-
1
),
substring
(
b
,
-
2
),
substring
(
b
,
-
3
),
substring
(
b
,
-
4
),
substring
(
b
,
-
5
)
from
t1
;
select
*
from
(
select
*
,
substring
(
b
,
1
),
substring
(
b
,
-
1
),
substring
(
b
,
-
2
),
substring
(
b
,
-
3
),
substring
(
b
,
-
4
),
substring
(
b
,
-
5
)
from
t1
)
t
;
drop
table
t1
;
sql/item_strfunc.cc
View file @
1d89bca0
...
...
@@ -1065,7 +1065,8 @@ void Item_func_substr::fix_length_and_dec()
collation
.
set
(
args
[
0
]
->
collation
);
if
(
args
[
1
]
->
const_item
())
{
int32
start
=
(
int32
)
args
[
1
]
->
val_int
()
-
1
;
int32
start
=
(
int32
)
args
[
1
]
->
val_int
();
start
=
(
int32
)((
start
<
0
)
?
max_length
+
start
:
start
-
1
);
if
(
start
<
0
||
start
>=
(
int32
)
max_length
)
max_length
=
0
;
/* purecov: inspected */
else
...
...
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