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
9c897762
Commit
9c897762
authored
Jan 18, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into rakia.gmz:/home/kgeorge/mysql/autopush/B25382-5.0-opt
parents
759a028c
4ced38b8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
3 deletions
+87
-3
mysql-test/r/udf.result
mysql-test/r/udf.result
+34
-0
mysql-test/t/udf.test
mysql-test/t/udf.test
+47
-0
sql/item_func.cc
sql/item_func.cc
+6
-3
No files found.
mysql-test/r/udf.result
View file @
9c897762
...
...
@@ -240,3 +240,37 @@ drop table bug18761;
select is_const((1,2,3));
ERROR 21000: Operand should contain 1 column(s)
drop function if exists is_const;
CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
create function f1(p1 varchar(255))
returns varchar(255)
begin
return metaphon(p1);
end//
create function f2(p1 varchar(255))
returns double
begin
return myfunc_double(p1);
end//
create function f3(p1 varchar(255))
returns double
begin
return myfunc_int(p1);
end//
select f3(NULL);
f3(NULL)
0
select f2(NULL);
f2(NULL)
NULL
select f1(NULL);
f1(NULL)
NULL
drop function f1;
drop function f2;
drop function f3;
drop function metaphon;
drop function myfunc_double;
drop function myfunc_int;
End of 5.0 tests.
mysql-test/t/udf.test
View file @
9c897762
...
...
@@ -242,3 +242,50 @@ drop table bug18761;
select
is_const
((
1
,
2
,
3
));
drop
function
if
exists
is_const
;
#
# Bug #25382: Passing NULL to an UDF called from stored procedures
# crashes server
#
--
replace_result
$UDF_EXAMPLE_LIB
UDF_EXAMPLE_LIB
eval
CREATE
FUNCTION
metaphon
RETURNS
STRING
SONAME
"
$UDF_EXAMPLE_LIB
"
;
--
replace_result
$UDF_EXAMPLE_LIB
UDF_EXAMPLE_LIB
eval
CREATE
FUNCTION
myfunc_double
RETURNS
REAL
SONAME
"
$UDF_EXAMPLE_LIB
"
;
--
replace_result
$UDF_EXAMPLE_LIB
UDF_EXAMPLE_LIB
eval
CREATE
FUNCTION
myfunc_int
RETURNS
INTEGER
SONAME
"
$UDF_EXAMPLE_LIB
"
;
delimiter
//;
create
function
f1
(
p1
varchar
(
255
))
returns
varchar
(
255
)
begin
return
metaphon
(
p1
);
end
//
create
function
f2
(
p1
varchar
(
255
))
returns
double
begin
return
myfunc_double
(
p1
);
end
//
create
function
f3
(
p1
varchar
(
255
))
returns
double
begin
return
myfunc_int
(
p1
);
end
//
delimiter
;
//
select
f3
(
NULL
);
select
f2
(
NULL
);
select
f1
(
NULL
);
drop
function
f1
;
drop
function
f2
;
drop
function
f3
;
drop
function
metaphon
;
drop
function
myfunc_double
;
drop
function
myfunc_int
;
--
echo
End
of
5.0
tests
.
sql/item_func.cc
View file @
9c897762
...
...
@@ -2729,25 +2729,28 @@ udf_handler::fix_fields(THD *thd, Item_result_field *func,
if
(
arguments
[
i
]
->
const_item
())
{
if
(
arguments
[
i
]
->
null_value
)
continue
;
switch
(
arguments
[
i
]
->
result_type
())
{
case
STRING_RESULT
:
case
DECIMAL_RESULT
:
{
String
*
res
=
arguments
[
i
]
->
val_str
(
&
buffers
[
i
]);
if
(
arguments
[
i
]
->
null_value
)
continue
;
f_args
.
args
[
i
]
=
(
char
*
)
res
->
ptr
();
break
;
}
case
INT_RESULT
:
*
((
longlong
*
)
to
)
=
arguments
[
i
]
->
val_int
();
if
(
arguments
[
i
]
->
null_value
)
continue
;
f_args
.
args
[
i
]
=
to
;
to
+=
ALIGN_SIZE
(
sizeof
(
longlong
));
break
;
case
REAL_RESULT
:
*
((
double
*
)
to
)
=
arguments
[
i
]
->
val_real
();
if
(
arguments
[
i
]
->
null_value
)
continue
;
f_args
.
args
[
i
]
=
to
;
to
+=
ALIGN_SIZE
(
sizeof
(
double
));
break
;
...
...
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