Saved Procedures
A stored procedure is MySQL code written and executed by MySQL.
Saved Function Example
CREATE FUNCTION AreWeThereYet(Location integer) RETURNS boolean
BEGIN
Return 0;
END
Stored Procedure Example
CREATE PROCEDURE InsertRow(A integer)
BEGIN
INSERT INTO table1 VALUES(A);
END
SLM
A UDF is C (++) or similar code compiled as .so (linux) or .dll (windows)
What are you inserting into MySQL using the command:
CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so'; //linux
CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.dll'; //windows
UDF , .
SO
UDF , , , / ( / ..)
.:
http://dev.mysql.com/doc/refman/5.1/en/stored-routines.html
UDF .:
http://dev.mysql.com/doc/refman/5.1/en/udf-compiling.html
SO-
: MySQL?
php?: PHP MySQL?
views sproc?: MySQL:
sproc : mysql
sproc: MySQL
php
$query = "SELECT * FROM table1";
-- call to stored proc
$query = "CALL InsertARow('1')";
-- use a stored function
$query = "SELECT AreWeThereYet('10')";
-- or
$query = "SELECT * FROM table1 WHERE AreWeThereYet(field1) = '1' ";
.