mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
c3c5f8d6d7
into mysql.com:/home/jimw/my/mysql-5.1-clean BitKeeper/etc/ignore: auto-union BitKeeper/deleted/.del-mysql_upgrade.dsp: Delete: VC++Files/client/mysql_upgrade.dsp BitKeeper/deleted/.del-mysql_upgrade_ia64.dsp: Delete: VC++Files/client/mysql_upgrade_ia64.dsp BitKeeper/deleted/.del-mysql_upgrade.c: Delete: client/mysql_upgrade.c VC++Files/mysql.dsw: Auto merged VC++Files/mysql.sln: Auto merged VC++Files/mysql_ia64.dsw: Auto merged client/mysql.cc: Auto merged config/ac-macros/zlib.m4: Auto merged configure.in: Auto merged extra/yassl/Makefile.am: Auto merged extra/yassl/taocrypt/Makefile.am: Auto merged include/my_global.h: Auto merged include/mysql.h: Auto merged libmysql/libmysql.def: Auto merged libmysqld/libmysqld.def: Auto merged mysql-test/r/grant2.result: Auto merged mysql-test/r/sp-security.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/trigger.result: Auto merged mysql-test/r/udf.result: Auto merged mysql-test/t/grant2.test: Auto merged mysql-test/t/rpl_openssl.test: Auto merged mysql-test/t/rpl_rotate_logs.test: Auto merged mysql-test/t/sp-security.test: Auto merged mysql-test/t/trigger.test: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_subselect.cc: Auto merged sql-common/client.c: Auto merged sql/mysqld.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_parse.cc: Auto merged client/Makefile.am: Resolve conflict config/ac-macros/yassl.m4: Resolve conflict mysql-test/include/have_udf.inc: Resolve conflict mysql-test/lib/mtr_process.pl: Resolve conflict mysql-test/mysql-test-run.pl: Resolve conflict mysql-test/r/have_udf.require: Resolve conflict mysql-test/r/rpl_openssl.result: Resolve conflict mysql-test/t/disabled.def: Resolve conflict mysql-test/t/information_schema.test: Resolve conflict server-tools/instance-manager/instance_options.cc: Resolve conflict sql/mysql_priv.h: Resolve conflict sql/set_var.cc: Resolve conflict support-files/mysql.spec.sh: Resolve conflict
87 lines
2.5 KiB
Text
87 lines
2.5 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;
|
|
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;
|