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
433e7fb8
Commit
433e7fb8
authored
Jul 07, 2006
by
bar@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/usr/home/bar/autopush/mysql-5.0.b10979
into mysql.com:/usr/home/bar/mysql-5.0-kt
parents
7939a200
ae03358b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
4 deletions
+41
-4
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+3
-0
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+5
-0
sql-common/client.c
sql-common/client.c
+31
-2
sql/item_strfunc.cc
sql/item_strfunc.cc
+2
-2
No files found.
mysql-test/r/func_str.result
View file @
433e7fb8
...
...
@@ -33,6 +33,9 @@ instr('hello','HE') instr('hello',binary 'HE') instr(binary 'hello','HE')
select position(binary 'll' in 'hello'),position('a' in binary 'hello');
position(binary 'll' in 'hello') position('a' in binary 'hello')
3 0
select left('hello',null), right('hello',null);
left('hello',null) right('hello',null)
NULL NULL
select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ;
left('hello',2) right('hello',2) substring('hello',2,2) mid('hello',1,5)
he lo el hello
...
...
mysql-test/t/func_str.test
View file @
433e7fb8
...
...
@@ -19,6 +19,11 @@ select hex(char(256));
select
locate
(
'he'
,
'hello'
),
locate
(
'he'
,
'hello'
,
2
),
locate
(
'lo'
,
'hello'
,
2
)
;
select
instr
(
'hello'
,
'HE'
),
instr
(
'hello'
,
binary
'HE'
),
instr
(
binary
'hello'
,
'HE'
);
select
position
(
binary
'll'
in
'hello'
),
position
(
'a'
in
binary
'hello'
);
#
# Bug#11728 string function LEFT,
# strange undocumented behaviour, strict mode
#
select
left
(
'hello'
,
null
),
right
(
'hello'
,
null
);
select
left
(
'hello'
,
2
),
right
(
'hello'
,
2
),
substring
(
'hello'
,
2
,
2
),
mid
(
'hello'
,
1
,
5
)
;
select
concat
(
''
,
left
(
right
(
concat
(
'what '
,
concat
(
'is '
,
'happening'
)),
9
),
4
),
''
,
substring
(
'monty'
,
5
,
1
))
;
select
substring_index
(
'www.tcx.se'
,
'.'
,
-
2
),
substring_index
(
'www.tcx.se'
,
'.'
,
1
);
...
...
sql-common/client.c
View file @
433e7fb8
...
...
@@ -1673,11 +1673,18 @@ C_MODE_START
int
mysql_init_character_set
(
MYSQL
*
mysql
)
{
NET
*
net
=
&
mysql
->
net
;
const
char
*
default_collation_name
;
/* Set character set */
if
(
!
mysql
->
options
.
charset_name
&&
!
(
mysql
->
options
.
charset_name
=
if
(
!
mysql
->
options
.
charset_name
)
{
default_collation_name
=
MYSQL_DEFAULT_COLLATION_NAME
;
if
(
!
(
mysql
->
options
.
charset_name
=
my_strdup
(
MYSQL_DEFAULT_CHARSET_NAME
,
MYF
(
MY_WME
))))
return
1
;
}
else
default_collation_name
=
NULL
;
{
const
char
*
save
=
charsets_dir
;
...
...
@@ -1685,6 +1692,28 @@ int mysql_init_character_set(MYSQL *mysql)
charsets_dir
=
mysql
->
options
.
charset_dir
;
mysql
->
charset
=
get_charset_by_csname
(
mysql
->
options
.
charset_name
,
MY_CS_PRIMARY
,
MYF
(
MY_WME
));
if
(
mysql
->
charset
&&
default_collation_name
)
{
CHARSET_INFO
*
collation
;
if
((
collation
=
get_charset_by_name
(
default_collation_name
,
MYF
(
MY_WME
))))
{
if
(
!
my_charset_same
(
mysql
->
charset
,
collation
))
{
my_printf_error
(
ER_UNKNOWN_ERROR
,
"COLLATION %s is not valid for CHARACTER SET %s"
,
MYF
(
0
),
default_collation_name
,
mysql
->
options
.
charset_name
);
mysql
->
charset
=
NULL
;
}
else
{
mysql
->
charset
=
collation
;
}
}
else
mysql
->
charset
=
NULL
;
}
charsets_dir
=
save
;
}
...
...
sql/item_strfunc.cc
View file @
433e7fb8
...
...
@@ -1038,7 +1038,7 @@ String *Item_func_left::val_str(String *str)
long
length
=
(
long
)
args
[
1
]
->
val_int
();
uint
char_pos
;
if
((
null_value
=
args
[
0
]
->
null_value
))
if
((
null_value
=
(
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
)
))
return
0
;
if
(
length
<=
0
)
return
&
my_empty_string
;
...
...
@@ -1078,7 +1078,7 @@ String *Item_func_right::val_str(String *str)
String
*
res
=
args
[
0
]
->
val_str
(
str
);
long
length
=
(
long
)
args
[
1
]
->
val_int
();
if
((
null_value
=
args
[
0
]
->
null_value
))
if
((
null_value
=
(
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
)
))
return
0
;
/* purecov: inspected */
if
(
length
<=
0
)
return
&
my_empty_string
;
/* purecov: inspected */
...
...
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