Oracle 5.0 Reference Manual page 2838

Table of Contents

Advertisement

1. Obtain the development source for MySQL 5.0. See
2. Obtain the
build utility, if necessary, from http://www.cmake.org. (Version 2.6 or later is
CMake
required).
3. In the source tree, look in the
there. Copy both files from this directory to your working directory.
udf_example.c
4. Create a
CMake makefile
PROJECT(udf_example)
# Path for MySQL include directory
INCLUDE_DIRECTORIES("c:/mysql/include")
ADD_DEFINITIONS("-DHAVE_DLOPEN")
ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def)
TARGET_LINK_LIBRARIES(udf_example wsock32)
5. Create the VC project and solution files:
cmake -G "<Generator>"
Invoking
cmake --help
6. Create udf_example.dll:
devenv udf_example.sln /build Release
After the shared object file has been installed, notify
statements. If object files have a suffix different from
throughout (for example,
mysql>
CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so';
mysql>
CREATE FUNCTION myfunc_double RETURNS REAL SONAME 'udf_example.so';
mysql>
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME 'udf_example.so';
mysql>
CREATE FUNCTION sequence RETURNS INTEGER SONAME 'udf_example.so';
mysql>
CREATE FUNCTION lookup RETURNS STRING SONAME 'udf_example.so';
mysql>
CREATE FUNCTION reverse_lookup
->
RETURNS STRING SONAME 'udf_example.so';
mysql>
CREATE AGGREGATE FUNCTION avgcost
->
RETURNS REAL SONAME 'udf_example.so';
To delete functions, use
mysql>
DROP FUNCTION metaphon;
mysql>
DROP FUNCTION myfunc_double;
mysql>
DROP FUNCTION myfunc_int;
mysql>
DROP FUNCTION sequence;
mysql>
DROP FUNCTION lookup;
mysql>
DROP FUNCTION reverse_lookup;
mysql>
DROP FUNCTION avgcost;
The
CREATE FUNCTION
database. The function's name, type and shared library name are saved in the table. You must
mysql
have the
[577]
INSERT
respectively.
You should not use
CREATE FUNCTION
need to reinstall a function, you should remove it with
FUNCTION. You would need to do this, for example, if you recompile a new version of your
CREATE
function, so that
mysqld
An active function is one that has been loaded with
FUNCTION. All active functions are reloaded each time the server starts, unless you start
the
--skip-grant-tables
unavailable.
Adding a New User-Defined Function
directory. There are files named
sql
(CMakeLists.txt) with these contents:
shows you a list of valid Generators.
on Windows).
.dll
DROP
FUNCTION:
and
DROP FUNCTION
or
[577]
privilege for the
DELETE
to add a function that has previously been created. If you
gets the new version. Otherwise, the server continues to use the old version.
[420]
option. In this case, UDF initialization is skipped and UDFs are
2818
Section 2.5, "How to Get
about the new functions with the following
mysqld
on your system, substitute the correct suffix
.so
statements update the
database to create or drop functions,
mysql
DROP FUNCTION
CREATE FUNCTION
MySQL".
udf_example.def
system table in the
func
and then reinstall it with
and not removed with
mysqld
DROP
with

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents