~ubuntu-branches/ubuntu/hardy/mysql-dfsg-5.0/hardy-updates

« back to all changes in this revision

Viewing changes to tests/udf_test

  • Committer: Bazaar Package Importer
  • Author(s): sean finney
  • Date: 2007-05-13 12:32:45 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20070513123245-8c3l187dk34cz2ar
Tags: 5.0.41-2
the previous "translation changes" inadvertently introduced unrelated
changes in the package control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# For this script to work, you need to compile and install the
3
 
# udf_example script !
4
 
#
5
 
 
6
 
CREATE FUNCTION metaphon RETURNS STRING SONAME "udf_example.so";
7
 
CREATE FUNCTION myfunc_double RETURNS REAL SONAME "udf_example.so";
8
 
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "udf_example.so";
9
 
CREATE FUNCTION lookup RETURNS STRING SONAME "udf_example.so";
10
 
CREATE FUNCTION reverse_lookup RETURNS STRING SONAME "udf_example.so";
11
 
CREATE AGGREGATE FUNCTION avgcost RETURNS REAL SONAME "udf_example.so";
12
 
CREATE FUNCTION myfunc_argument_name RETURNS STRING SONAME "udf_example.so";
13
 
 
14
 
select metaphon("hello"); 
15
 
select myfunc_double("hello","world");
16
 
select myfunc_int(1,2,3),myfunc_int("1","11","111");
17
 
select lookup("localhost");
18
 
select reverse_lookup("127.0.0.1");
19
 
 
20
 
create temporary table t1 (a int,b double);
21
 
insert into t1 values (1,5),(1,4),(2,8),(3,9),(4,11);
22
 
select avgcost(a,b) from t1;
23
 
select avgcost(a,b) from t1 group by a;
24
 
select a, myfunc_argument_name(a), myfunc_argument_name(a as b) from t1;
25
 
drop table t1;
26
 
 
27
 
DROP FUNCTION metaphon;
28
 
DROP FUNCTION myfunc_double;
29
 
DROP FUNCTION myfunc_int;
30
 
DROP FUNCTION lookup;
31
 
DROP FUNCTION reverse_lookup;
32
 
DROP FUNCTION avgcost;
33
 
DROP FUNCTION myfunc_argument_name;