summaryrefslogtreecommitdiff
path: root/tests/udf_test
diff options
context:
space:
mode:
authorbk@work.mysql.com <>2000-07-31 21:29:14 +0200
committerbk@work.mysql.com <>2000-07-31 21:29:14 +0200
commitf4c589ff6c653d1d2a09c26e46ead3c8a15655d8 (patch)
treed253a359142dfc1ed247d5d4365d86972ea31109 /tests/udf_test
parent7eec25e393727b16bb916b50d82b0aa3084e065c (diff)
downloadmariadb-git-f4c589ff6c653d1d2a09c26e46ead3c8a15655d8.tar.gz
Import changeset
Diffstat (limited to 'tests/udf_test')
-rw-r--r--tests/udf_test30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/udf_test b/tests/udf_test
new file mode 100644
index 00000000000..4621a7b34a5
--- /dev/null
+++ b/tests/udf_test
@@ -0,0 +1,30 @@
+#
+# For this script to work, you need to compile and install the
+# udf_example script !
+#
+
+CREATE FUNCTION metaphon RETURNS STRING SONAME "udf_example.so";
+CREATE FUNCTION myfunc_double RETURNS REAL SONAME "udf_example.so";
+CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "udf_example.so";
+CREATE FUNCTION lookup RETURNS STRING SONAME "udf_example.so";
+CREATE FUNCTION reverse_lookup RETURNS STRING SONAME "udf_example.so";
+CREATE AGGREGATE FUNCTION avgcost RETURNS REAL SONAME "udf_example.so";
+
+select metaphon("hello");
+select myfunc_double("hello","world");
+select myfunc_int(1,2,3),myfunc_int("1","11","111");
+select lookup("localhost");
+select reverse_lookup("127.0.0.1");
+
+create temporary table t1 (a int,b double);
+insert into t1 values (1,5),(1,4),(2,8),(3,9),(4,11);
+select avgcost(a,b) from t1;
+select avgcost(a,b) from t1 group by a;
+drop table t1;
+
+DROP FUNCTION metaphon;
+DROP FUNCTION myfunc_double;
+DROP FUNCTION myfunc_int;
+DROP FUNCTION lookup;
+DROP FUNCTION reverse_lookup;
+DROP FUNCTION avgcost;