mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 05:22:25 +01:00
f68085c4e7
into bodhi.local:/opt/local/work/mysql-5.1-runtime-merge BitKeeper/etc/ignore: auto-union BitKeeper/deleted/.del-im_options_set.result~59278f56be61d921: Auto merged BitKeeper/deleted/.del-mysqld.dsp~ffdbf2d234e23e56: Auto merged BitKeeper/deleted/.del-mysys.dsp~32695fee91189326: Auto merged BitKeeper/deleted/.del-im_options_set.imtest~b53d9d60e5684833: Auto merged BitKeeper/deleted/.del-im_options_unset.imtest~768eb186b51d0048: Auto merged BitKeeper/deleted/.del-im_options_unset.result~20a4790cd3c70a4f: Auto merged client/mysql.cc: Auto merged client/mysqlbinlog.cc: Auto merged client/mysqlcheck.c: Auto merged client/mysqldump.c: Auto merged client/mysqltest.c: Auto merged dbug/dbug.c: Auto merged extra/perror.c: Auto merged extra/yassl/src/yassl_imp.cpp: Auto merged extra/yassl/src/yassl_int.cpp: Auto merged include/mysql.h: Auto merged include/mysql_com.h: Auto merged libmysql/libmysql.c: Auto merged mysql-test/r/cast.result: Auto merged mysql-test/r/date_formats.result: Auto merged mysql-test/r/federated.result: Auto merged mysql-test/r/func_compress.result: Auto merged mysql-test/r/func_group.result: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/r/gis-rtree.result: Auto merged mysql-test/r/gis.result: Auto merged mysql-test/r/im_daemon_life_cycle.result: Auto merged mysql-test/r/im_utils.result: Auto merged mysql-test/r/join_outer.result: Auto merged mysql-test/r/mysqlcheck.result: Auto merged mysql-test/r/rpl_sp.result: Auto merged mysql-test/r/rpl_trigger.result: Auto merged mysql-test/r/sp-code.result: Auto merged mysql-test/r/sp-security.result: Auto merged mysql-test/r/strict.result: Auto merged mysql-test/r/type_blob.result: Auto merged mysql-test/r/type_datetime.result: Auto merged mysql-test/r/type_ranges.result: Auto merged mysql-test/r/udf.result: Auto merged mysql-test/r/user_var.result: Auto merged mysql-test/t/cast.test: Auto merged mysql-test/t/disabled.def: Auto merged mysql-test/t/func_group.test: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/im_daemon_life_cycle.imtest: Auto merged mysql-test/t/im_life_cycle.imtest: Auto merged mysql-test/t/im_utils.imtest: Auto merged mysql-test/t/mysql.test: Auto merged mysql-test/t/mysqlbinlog.test: Auto merged mysql-test/t/mysqlcheck.test: Auto merged mysql-test/t/ps.test: Auto merged mysql-test/t/rpl_trigger.test: Auto merged mysql-test/t/sp-security.test: Auto merged mysql-test/t/strict.test: Auto merged mysql-test/t/udf.test: Auto merged sql/field.cc: Auto merged sql/item.cc: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_strfunc.cc: Auto merged sql/item_strfunc.h: Auto merged sql/item_subselect.cc: Auto merged sql/item_sum.h: Auto merged sql/item_timefunc.cc: Auto merged sql/mysqld.cc: Auto merged sql/protocol.cc: Auto merged sql/slave.cc: Auto merged sql/sp.cc: Auto merged sql/sp_head.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_lex.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_udf.cc: Auto merged sql/sql_view.cc: Auto merged sql/table.cc: Auto merged sql-common/client.c: Auto merged sql-common/my_time.c: Auto merged sql/table.h: Auto merged storage/ndb/src/kernel/error/ndbd_exit_codes.c: Auto merged storage/ndb/src/mgmsrv/ConfigInfo.cpp: Auto merged mysql-test/r/im_life_cycle.result: e use local mysql-test/r/ps.result: use local client/Makefile.am: Manual merge. client/mysqlimport.c: Manual merge. configure.in: Manual merge. mysql-test/mysql-test-run.pl: Manual merge. mysql-test/r/mysqldump.result: Manual merge. mysql-test/r/mysqltest.result: Manual merge. mysql-test/r/ndb_basic.result: Manual merge. mysql-test/r/rpl_view.result: Manual merge. mysql-test/r/show_check.result: Manual merge. mysql-test/r/sp-error.result: Manual merge. mysql-test/r/sp.result: Manual merge. mysql-test/r/union.result: Manual merge. mysql-test/t/mysqldump.test: Manual merge. mysql-test/t/mysqltest.test: Manual merge. mysql-test/t/ndb_basic.test: Manual merge. mysql-test/t/rpl_sp.test: Manual merge. mysql-test/t/rpl_view.test: Manual merge. mysql-test/t/show_check.test: Manual merge. mysql-test/t/sp-error.test: Manual merge. mysql-test/t/sp.test: Manual merge. sql/item_sum.cc: Manual merge. sql/mysql_priv.h: Manual merge. sql/sp_head.cc: Manual merge. sql/sql_db.cc: Manual merge. sql/sql_delete.cc: Manual merge. sql/sql_lex.h: Manual merge. sql/sql_show.cc: Manual merge. sql/sql_table.cc: Manual merge. sql/sql_trigger.cc: Manual merge. sql/sql_yacc.yy: Manual merge. tests/mysql_client_test.c: Manual merge.
117 lines
3.4 KiB
Text
117 lines
3.4 KiB
Text
drop table if exists t1;
|
|
CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
|
|
CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
|
|
CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
|
|
ERROR HY000: Can't find symbol 'myfunc_nonexist' in library
|
|
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
|
|
CREATE FUNCTION sequence RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
|
|
CREATE FUNCTION lookup RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
|
|
CREATE FUNCTION reverse_lookup
|
|
RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
|
|
CREATE AGGREGATE FUNCTION avgcost
|
|
RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
|
|
select myfunc_double();
|
|
ERROR HY000: myfunc_double must have at least one argument
|
|
select myfunc_double(1);
|
|
myfunc_double(1)
|
|
49.00
|
|
select myfunc_double(78654);
|
|
myfunc_double(78654)
|
|
54.00
|
|
select myfunc_nonexist();
|
|
ERROR 42000: FUNCTION test.myfunc_nonexist does not exist
|
|
select myfunc_int();
|
|
myfunc_int()
|
|
0
|
|
select lookup();
|
|
ERROR HY000: Wrong arguments to lookup; Use the source
|
|
select lookup("127.0.0.1");
|
|
lookup("127.0.0.1")
|
|
127.0.0.1
|
|
select lookup(127,0,0,1);
|
|
ERROR HY000: Wrong arguments to lookup; Use the source
|
|
select lookup("localhost");
|
|
lookup("localhost")
|
|
127.0.0.1
|
|
select reverse_lookup();
|
|
ERROR HY000: Wrong number of arguments to reverse_lookup; Use the source
|
|
select reverse_lookup("127.0.0.1");
|
|
select reverse_lookup(127,0,0,1);
|
|
select reverse_lookup("localhost");
|
|
reverse_lookup("localhost")
|
|
NULL
|
|
select avgcost();
|
|
ERROR HY000: wrong number of arguments: AVGCOST() requires two arguments
|
|
select avgcost(100,23.76);
|
|
ERROR HY000: wrong argument type: AVGCOST() requires an INT and a REAL
|
|
create table t1(sum int, price float(24));
|
|
insert into t1 values(100, 50.00), (100, 100.00);
|
|
select avgcost(sum, price) from t1;
|
|
avgcost(sum, price)
|
|
75.0000
|
|
delete from t1;
|
|
insert into t1 values(100, 54.33), (200, 199.99);
|
|
select avgcost(sum, price) from t1;
|
|
avgcost(sum, price)
|
|
151.4367
|
|
drop table t1;
|
|
select metaphon('hello');
|
|
metaphon('hello')
|
|
HL
|
|
CREATE PROCEDURE `XXX1`(in testval varchar(10))
|
|
begin
|
|
select metaphon(testval);
|
|
end//
|
|
call XXX1('hello');
|
|
metaphon(testval)
|
|
HL
|
|
drop procedure xxx1;
|
|
CREATE PROCEDURE `XXX2`()
|
|
begin
|
|
declare testval varchar(10);
|
|
set testval = 'hello';
|
|
select metaphon(testval);
|
|
end//
|
|
call XXX2();
|
|
metaphon(testval)
|
|
HL
|
|
drop procedure xxx2;
|
|
CREATE TABLE bug19904(n INT, v varchar(10));
|
|
INSERT INTO bug19904 VALUES (1,'one'),(2,'two'),(NULL,NULL),(3,'three'),(4,'four');
|
|
SELECT myfunc_double(n) AS f FROM bug19904;
|
|
f
|
|
49.00
|
|
50.00
|
|
NULL
|
|
51.00
|
|
52.00
|
|
SELECT metaphon(v) AS f FROM bug19904;
|
|
f
|
|
ON
|
|
TW
|
|
NULL
|
|
0R
|
|
FR
|
|
DROP TABLE bug19904;
|
|
CREATE DEFINER=CURRENT_USER() FUNCTION should_not_parse
|
|
RETURNS STRING SONAME "should_not_parse.so";
|
|
ERROR HY000: Incorrect usage of SONAME and DEFINER
|
|
CREATE DEFINER=someone@somewhere FUNCTION should_not_parse
|
|
RETURNS STRING SONAME "should_not_parse.so";
|
|
ERROR HY000: Incorrect usage of SONAME and DEFINER
|
|
create table t1(f1 int);
|
|
insert into t1 values(1),(2);
|
|
explain select myfunc_int(f1) from t1 order by 1;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
|
|
drop table t1;
|
|
End of 5.0 tests.
|
|
DROP FUNCTION metaphon;
|
|
DROP FUNCTION myfunc_double;
|
|
DROP FUNCTION myfunc_nonexist;
|
|
ERROR 42000: FUNCTION test.myfunc_nonexist does not exist
|
|
DROP FUNCTION myfunc_int;
|
|
DROP FUNCTION sequence;
|
|
DROP FUNCTION lookup;
|
|
DROP FUNCTION reverse_lookup;
|
|
DROP FUNCTION avgcost;
|