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
7ac7bfc3
Commit
7ac7bfc3
authored
Jun 01, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix handling of NULL fields in FIELD(). (Bug #10944)
parent
e877e71b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
4 deletions
+20
-4
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
+6
-0
sql/item_func.cc
sql/item_func.cc
+8
-4
No files found.
mysql-test/r/func_str.result
View file @
7ac7bfc3
...
@@ -783,3 +783,9 @@ id aes_decrypt(str, 'bar')
...
@@ -783,3 +783,9 @@ id aes_decrypt(str, 'bar')
1 foo
1 foo
2 NULL
2 NULL
DROP TABLE t1, t2;
DROP TABLE t1, t2;
select field(0,NULL,1,0), field("",NULL,"bar",""), field(0.0,NULL,1.0,0.0);
field(0,NULL,1,0) field("",NULL,"bar","") field(0.0,NULL,1.0,0.0)
3 3 3
select field(NULL,1,2,NULL), field(NULL,1,2,0);
field(NULL,1,2,NULL) field(NULL,1,2,0)
0 0
mysql-test/t/func_str.test
View file @
7ac7bfc3
...
@@ -521,3 +521,9 @@ SELECT t1.id, aes_decrypt(str, 'bar') FROM t1, t2 WHERE t1.id = t2.id
...
@@ -521,3 +521,9 @@ SELECT t1.id, aes_decrypt(str, 'bar') FROM t1, t2 WHERE t1.id = t2.id
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
# Bug #10944: Mishandling of NULL arguments in FIELD()
#
select
field
(
0
,
NULL
,
1
,
0
),
field
(
""
,
NULL
,
"bar"
,
""
),
field
(
0.0
,
NULL
,
1.0
,
0.0
);
select
field
(
NULL
,
1
,
2
,
NULL
),
field
(
NULL
,
1
,
2
,
0
);
sql/item_func.cc
View file @
7ac7bfc3
...
@@ -1488,6 +1488,10 @@ void Item_func_locate::print(String *str)
...
@@ -1488,6 +1488,10 @@ void Item_func_locate::print(String *str)
longlong
Item_func_field
::
val_int
()
longlong
Item_func_field
::
val_int
()
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
if
(
args
[
0
]
->
null_value
)
return
0
;
if
(
cmp_type
==
STRING_RESULT
)
if
(
cmp_type
==
STRING_RESULT
)
{
{
String
*
field
;
String
*
field
;
...
@@ -1505,8 +1509,8 @@ longlong Item_func_field::val_int()
...
@@ -1505,8 +1509,8 @@ longlong Item_func_field::val_int()
longlong
val
=
args
[
0
]
->
val_int
();
longlong
val
=
args
[
0
]
->
val_int
();
for
(
uint
i
=
1
;
i
<
arg_count
;
i
++
)
for
(
uint
i
=
1
;
i
<
arg_count
;
i
++
)
{
{
if
(
val
==
args
[
i
]
->
val_int
())
if
(
!
args
[
i
]
->
null_value
&&
val
==
args
[
i
]
->
val_int
())
return
(
longlong
)
(
i
);
return
(
longlong
)
(
i
);
}
}
}
}
else
else
...
@@ -1514,8 +1518,8 @@ longlong Item_func_field::val_int()
...
@@ -1514,8 +1518,8 @@ longlong Item_func_field::val_int()
double
val
=
args
[
0
]
->
val
();
double
val
=
args
[
0
]
->
val
();
for
(
uint
i
=
1
;
i
<
arg_count
;
i
++
)
for
(
uint
i
=
1
;
i
<
arg_count
;
i
++
)
{
{
if
(
val
==
args
[
i
]
->
val
())
if
(
!
args
[
i
]
->
null_value
&&
val
==
args
[
i
]
->
val
())
return
(
longlong
)
(
i
);
return
(
longlong
)
(
i
);
}
}
}
}
return
0
;
return
0
;
...
...
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