~mdcallag/+junk/5.1-map

« back to all changes in this revision

Viewing changes to tests/udf_test.res

  • Committer: msvensson at pilot
  • Date: 2007-04-24 09:11:45 UTC
  • mfrom: (2469.1.106)
  • Revision ID: sp1r-msvensson@pilot.blaudden-20070424091145-10463
Merge pilot.blaudden:/home/msvensson/mysql/my51-m-mysql_upgrade
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
--------------
2
 
CREATE FUNCTION metaphon RETURNS STRING SONAME "udf_example.so"
3
 
--------------
4
 
 
5
 
Query OK, 0 rows affected
6
 
 
7
 
--------------
8
 
CREATE FUNCTION myfunc_double RETURNS REAL SONAME "udf_example.so"
9
 
--------------
10
 
 
11
 
Query OK, 0 rows affected
12
 
 
13
 
--------------
14
 
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "udf_example.so"
15
 
--------------
16
 
 
17
 
Query OK, 0 rows affected
18
 
 
19
 
--------------
20
 
CREATE FUNCTION lookup RETURNS STRING SONAME "udf_example.so"
21
 
--------------
22
 
 
23
 
Query OK, 0 rows affected
24
 
 
25
 
--------------
26
 
CREATE FUNCTION reverse_lookup RETURNS STRING SONAME "udf_example.so"
27
 
--------------
28
 
 
29
 
Query OK, 0 rows affected
30
 
 
31
 
--------------
32
 
CREATE AGGREGATE FUNCTION avgcost RETURNS REAL SONAME "udf_example.so"
33
 
--------------
34
 
 
35
 
Query OK, 0 rows affected
36
 
 
37
 
--------------
38
 
CREATE FUNCTION myfunc_argument_name RETURNS STRING SONAME "udf_example.so"
39
 
--------------
40
 
 
41
 
Query OK, 0 rows affected
42
 
 
43
 
--------------
44
 
select metaphon("hello")
45
 
--------------
46
 
 
47
 
metaphon("hello")
48
 
HL
49
 
1 row in set
50
 
 
51
 
--------------
52
 
select myfunc_double("hello","world")
53
 
--------------
54
 
 
55
 
myfunc_double("hello","world")
56
 
108.40
57
 
1 row in set
58
 
 
59
 
--------------
60
 
select myfunc_int(1,2,3),myfunc_int("1","11","111")
61
 
--------------
62
 
 
63
 
myfunc_int(1,2,3)       myfunc_int("1","11","111")
64
 
6       6
65
 
1 row in set
66
 
 
67
 
--------------
68
 
select lookup("localhost")
69
 
--------------
70
 
 
71
 
lookup("localhost")
72
 
127.0.0.1
73
 
1 row in set
74
 
 
75
 
--------------
76
 
select reverse_lookup("127.0.0.1")
77
 
--------------
78
 
 
79
 
reverse_lookup("127.0.0.1")
80
 
localhost
81
 
1 row in set
82
 
 
83
 
--------------
84
 
create temporary table t1 (a int,b double)
85
 
--------------
86
 
 
87
 
Query OK, 0 rows affected
88
 
 
89
 
--------------
90
 
insert into t1 values (1,5),(1,4),(2,8),(3,9),(4,11)
91
 
--------------
92
 
 
93
 
Query OK, 5 rows affected
94
 
Records: 0  Duplicates: 5  Warnings: 0
95
 
 
96
 
--------------
97
 
select avgcost(a,b) from t1
98
 
--------------
99
 
 
100
 
avgcost(a,b)
101
 
8.7273
102
 
1 row in set
103
 
 
104
 
--------------
105
 
select avgcost(a,b) from t1 group by a
106
 
--------------
107
 
 
108
 
avgcost(a,b)
109
 
4.5000
110
 
8.0000
111
 
9.0000
112
 
11.0000
113
 
4 rows in set
114
 
 
115
 
--------------
116
 
select a, myfunc_argument_name(a) from t1;
117
 
--------------
118
 
 
119
 
a       myfunc_argument_name(a) myfunc_argument_name(a as b)
120
 
1       a       b
121
 
1       a       b
122
 
2       a       b
123
 
3       a       b
124
 
4       a       b
125
 
5 rows in set
126
 
 
127
 
--------------
128
 
drop table t1
129
 
--------------
130
 
 
131
 
Query OK, 0 rows affected
132
 
 
133
 
--------------
134
 
DROP FUNCTION metaphon
135
 
--------------
136
 
 
137
 
Query OK, 0 rows affected
138
 
 
139
 
--------------
140
 
DROP FUNCTION myfunc_double
141
 
--------------
142
 
 
143
 
Query OK, 0 rows affected
144
 
 
145
 
--------------
146
 
DROP FUNCTION myfunc_int
147
 
--------------
148
 
 
149
 
Query OK, 0 rows affected
150
 
 
151
 
--------------
152
 
DROP FUNCTION lookup
153
 
--------------
154
 
 
155
 
Query OK, 0 rows affected
156
 
 
157
 
--------------
158
 
DROP FUNCTION reverse_lookup
159
 
--------------
160
 
 
161
 
Query OK, 0 rows affected
162
 
 
163
 
--------------
164
 
DROP FUNCTION avgcost
165
 
--------------
166
 
 
167
 
Query OK, 0 rows affected
168
 
 
169
 
--------------
170
 
DROP FUNCTION myfunc_argument_name;
171
 
--------------
172
 
 
173
 
Query OK, 0 rows affected
174
 
 
175
 
Bye