Hi Mark,

Have you looked at the work that Eric and I have done for External Language Stored Procedures?

There is no reason why that cannot be re-implemented in Drizzle - which would give it a SQL standards conforming (at least, from the POV of the SQL) implementation and is lightweight (after enough old sp cruft is cleaned up). The api which Eric and I have worked out is already designed to handle aggregate types, we just haven't implemented that on the wl820 branch because of 2 reasons:
1. MySQL's SP framework cannot support aggregate functionons.
2. The SQL standard does not define a syntax for declaring aggregate functions.

Regards,
Antony.

On 12 Jul 2008, at 20:30, Mark Atwood wrote:

I've checked in a first pass at converting the UDF mechanism to use the plugin architecture.

This was necessary, since there is no more mysql database, there is no more mysql.func table, and there is no more CREATE FUNCTION syntax.

My tree is at lp:~fallenpegasus/drizzle/hack_udf

I think Brian has merged it with the main tree.

I've also created a blueprint "Redo UDF to use the plugin system" at https://blueprints.launchpad.net/drizzle/+spec/plugin-udf . Feel free to make suggestions and contributions to the blueprint.

This first cut is really ugly, and has a lot of stuff left over from the "old way" of doing things that will go away soonish.

You can look at plugins/hello_world for an example of an example UDF.

The quick summery is that you make a plugin project, and in the mysql_declare_plugin, do as the follows:


struct st_mysql_udf hello_world_plugin=
{ MYSQL_UDF_INTERFACE_VERSION  };

mysql_declare_plugin(hello_world)
{
 MYSQL_UDF_PLUGIN,
 &hello_world_plugin,
 "hello_world",
 "Mark Atwood",
 "Hello, world!",
 PLUGIN_LICENSE_GPL,
 hello_world_plugin_init, /* Plugin Init */
 hello_world_plugin_deinit, /* Plugin Deinit */
 0x0100,  /* 1.0 */
 NULL,   /* status variables */
 NULL,   /* system variables */
 NULL    /* config options */
}
mysql_declare_plugin_end;



the plugin_init and plugin_deinit functions are currently being passed a udf_func structure pointer, instead of a pointer to a struct st_plugin_int .

In your plugin_init function, you have to fill in the members of the udf_func structure, including the func_init, func_deinit, and func pointers, to point to the old-style UDF init, deinit, and action functions.

Existing UDFs can be ported over to this without too much pain, by keeping them as they are, but adding the mysql_declare_plugin specification, and the init and deinit functions as it expects, and keeping your existing UDF init, deinit, and action functions.

The next rev will be less redundant, but will prequire more porting work for existing UDFs.



Yes, its very indirect and redundant.  That will get fixed.

--
Mark Atwood <http://mark.atwood.name>




_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp


_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to