PDA

View Full Version : Adding Function to Mysql



RH1
05-17-2009, 11:20 AM
Anyone have some information or instructions on how to add a function to mysql. I have a script we need to use and uses a distance calculation. The function needs to be added to myslq and I have never done this. Any suggestions?

fivebean
05-19-2009, 08:29 AM
Without knowing what you are trying to accomplish its a little difficult. However, this should point you in the correct direction.

http://dev.mysql.com/doc/refman/5.0/en/adding-functions.html
http://www.databasejournal.com/features/mysql/article.php/3569846/MySQL-Stored-Functions.htm

Oracle
05-19-2009, 08:35 AM
There are three ways to add new functions to MySQL:
You can add functions through the user-defined function (UDF) interface. User-defined functions are compiled as object files and then added to and removed from the server dynamically using the CREATE FUNCTION and DROP FUNCTION statements.

You can add functions as native (built-in) MySQL functions. Native functions are compiled into the mysqld server and become available on a permanent basis.

Another way to add functions is by creating stored functions. These are written using SQL statements rather than by compiling object code. The syntax for writing stored functions is not covered here.

Each method of creating compiled functions has advantages and disadvantages:
If you write user-defined functions, you must install object files in addition to the server itself. If you compile your function into the server, you don't need to do that.
Native functions require you to modify a source distribution. UDFs do not. You can add UDFs to a binary MySQL distribution. No access to MySQL source is necessary.
If you upgrade your MySQL distribution, you can continue to use your previously installed UDFs, unless you upgrade to a newer version for which the UDF interface changes. For native functions, you must repeat your modifications each time you upgrade.........

RH1
05-19-2009, 11:13 AM
Yeah i found that same description on their website Oracle - I was hoping to actually find some instructions on doing it.

~ServerPoint~
05-20-2009, 04:21 AM
Do you have PHPmyadmin?

RH1
05-20-2009, 11:21 AM
Yes I do, Didnt think you could add something through that. Or can you ? ill have to look at that I guess. The developer of the script I have commisioned to have made is going to try a different route I think

HostEase
09-19-2009, 06:13 AM
Yes,you can add function with your PHPadmin.

~ServerPoint~
09-19-2009, 10:36 AM
Yes I do, Didnt think you could add something through that. Or can you ? ill have to look at that I guess. The developer of the script I have commisioned to have made is going to try a different route I think

You can create DB there and run sql queries

HostEase
09-28-2009, 09:36 PM
You can write a sql file then run the application,Also you can do it with your phpadmin.phpadmin is used to manage your datebase.