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
4bab622f
Commit
4bab622f
authored
Jul 07, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/usr/home/bar/mysql-5.0
into mysql.com:/usr/home/bar/mysql-5.0-kt
parents
5ac016a8
613cbb62
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 @
4bab622f
...
@@ -33,6 +33,9 @@ instr('hello','HE') instr('hello',binary 'HE') instr(binary 'hello','HE')
...
@@ -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');
select position(binary 'll' in 'hello'),position('a' in binary 'hello');
position(binary 'll' in 'hello') position('a' in binary 'hello')
position(binary 'll' in 'hello') position('a' in binary 'hello')
3 0
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) ;
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)
left('hello',2) right('hello',2) substring('hello',2,2) mid('hello',1,5)
he lo el hello
he lo el hello
...
...
mysql-test/t/func_str.test
View file @
4bab622f
...
@@ -19,6 +19,11 @@ select hex(char(256));
...
@@ -19,6 +19,11 @@ select hex(char(256));
select
locate
(
'he'
,
'hello'
),
locate
(
'he'
,
'hello'
,
2
),
locate
(
'lo'
,
'hello'
,
2
)
;
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
instr
(
'hello'
,
'HE'
),
instr
(
'hello'
,
binary
'HE'
),
instr
(
binary
'hello'
,
'HE'
);
select
position
(
binary
'll'
in
'hello'
),
position
(
'a'
in
binary
'hello'
);
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
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
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
);
select
substring_index
(
'www.tcx.se'
,
'.'
,
-
2
),
substring_index
(
'www.tcx.se'
,
'.'
,
1
);
...
...
sql-common/client.c
View file @
4bab622f
...
@@ -1673,11 +1673,18 @@ C_MODE_START
...
@@ -1673,11 +1673,18 @@ C_MODE_START
int
mysql_init_character_set
(
MYSQL
*
mysql
)
int
mysql_init_character_set
(
MYSQL
*
mysql
)
{
{
NET
*
net
=
&
mysql
->
net
;
NET
*
net
=
&
mysql
->
net
;
const
char
*
default_collation_name
;
/* Set character set */
/* Set character set */
if
(
!
mysql
->
options
.
charset_name
&&
if
(
!
mysql
->
options
.
charset_name
)
!
(
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
))))
my_strdup
(
MYSQL_DEFAULT_CHARSET_NAME
,
MYF
(
MY_WME
))))
return
1
;
return
1
;
}
else
default_collation_name
=
NULL
;
{
{
const
char
*
save
=
charsets_dir
;
const
char
*
save
=
charsets_dir
;
...
@@ -1685,6 +1692,28 @@ int mysql_init_character_set(MYSQL *mysql)
...
@@ -1685,6 +1692,28 @@ int mysql_init_character_set(MYSQL *mysql)
charsets_dir
=
mysql
->
options
.
charset_dir
;
charsets_dir
=
mysql
->
options
.
charset_dir
;
mysql
->
charset
=
get_charset_by_csname
(
mysql
->
options
.
charset_name
,
mysql
->
charset
=
get_charset_by_csname
(
mysql
->
options
.
charset_name
,
MY_CS_PRIMARY
,
MYF
(
MY_WME
));
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
;
charsets_dir
=
save
;
}
}
...
...
sql/item_strfunc.cc
View file @
4bab622f
...
@@ -1038,7 +1038,7 @@ String *Item_func_left::val_str(String *str)
...
@@ -1038,7 +1038,7 @@ String *Item_func_left::val_str(String *str)
long
length
=
(
long
)
args
[
1
]
->
val_int
();
long
length
=
(
long
)
args
[
1
]
->
val_int
();
uint
char_pos
;
uint
char_pos
;
if
((
null_value
=
args
[
0
]
->
null_value
))
if
((
null_value
=
(
args
[
0
]
->
null_value
||
args
[
1
]
->
null_value
)
))
return
0
;
return
0
;
if
(
length
<=
0
)
if
(
length
<=
0
)
return
&
my_empty_string
;
return
&
my_empty_string
;
...
@@ -1078,7 +1078,7 @@ String *Item_func_right::val_str(String *str)
...
@@ -1078,7 +1078,7 @@ String *Item_func_right::val_str(String *str)
String
*
res
=
args
[
0
]
->
val_str
(
str
);
String
*
res
=
args
[
0
]
->
val_str
(
str
);
long
length
=
(
long
)
args
[
1
]
->
val_int
();
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 */
return
0
;
/* purecov: inspected */
if
(
length
<=
0
)
if
(
length
<=
0
)
return
&
my_empty_string
;
/* purecov: inspected */
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