query for function/procedure metadata

This is a discussion on query for function/procedure metadata within the MySQL Database forums, part of the Database Forums category; I have been asked to compose a query to return the metadata of a function or procedure (MySQL 5.0): ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-24-2005
Laurenz Albe
 
Posts: n/a
Default query for function/procedure metadata

I have been asked to compose a query to return the metadata of a
function or procedure (MySQL 5.0): argument names and types, IN or OUT,
return value if appropriate.

The ultimate goal is to provide these metadata to an application that
accesses the database via .NET; the developer claims that there is no
way to retrieve these data via the .NET driver and asked me for a
workaround.

Selecting INFORMATION_SCHEMA.ROUTINES.ROUTINE_DEFINITION returns only
the function body.

I had the idea to write a function that issues a SHOW CREATE FUNCTION
and parses the result, but I am facing problems with this approach:

- There is nothing like a 'SHOW ... INTO <variable>'

- I considered declaring a cursor for the statement and retrieve the
SHOW result this way.
However, I found no way to declare a cursor for a dynamic statement.

Can anybody think of a way to achieve my goal?

Thank you,
Laurenz Albe
Reply With Quote
  #2 (permalink)  
Old 10-24-2005
Giuseppe Maxia
 
Posts: n/a
Default Re: query for function/procedure metadata

Laurenz Albe wrote:
> I have been asked to compose a query to return the metadata of a
> function or procedure (MySQL 5.0): argument names and types, IN or OUT,
> return value if appropriate.
>
> The ultimate goal is to provide these metadata to an application that
> accesses the database via .NET; the developer claims that there is no
> way to retrieve these data via the .NET driver and asked me for a
> workaround.
>
> Selecting INFORMATION_SCHEMA.ROUTINES.ROUTINE_DEFINITION returns only
> the function body.
>
> I had the idea to write a function that issues a SHOW CREATE FUNCTION
> and parses the result, but I am facing problems with this approach:
>
> - There is nothing like a 'SHOW ... INTO <variable>'
>
> - I considered declaring a cursor for the statement and retrieve the
> SHOW result this way.
> However, I found no way to declare a cursor for a dynamic statement.
>
> Can anybody think of a way to achieve my goal?
>
> Thank you,
> Laurenz Albe


I was trying to do exactly the same thing, and I found out that the
only viable solution, as of today, is to parse the output of
"SHOW CREATE FUNCTION ..." in the host language.

Quoting from the manual:
"INFORMATION_SCHEMA does not yet have a PARAMETERS table, so applications that need to acquire routine parameter
information at runtime must use workarounds such as parsing the output of SHOW CREATE statements."
http://dev.mysql.com/doc/refman/5.0/...trictions.html

ciao
gmax

--
_ _ _ _
(_|| | |(_|><
_|
http://gmax.oltrelinux.com
Reply With Quote
  #3 (permalink)  
Old 10-24-2005
Laurenz Albe
 
Posts: n/a
Default Re: query for function/procedure metadata

Giuseppe Maxia <gmax_@_cpan_._org> wrote:
> I was trying to do exactly the same thing, and I found out that the
> only viable solution, as of today, is to parse the output of
> "SHOW CREATE FUNCTION ..." in the host language.
>
> Quoting from the manual:
> "INFORMATION_SCHEMA does not yet have a PARAMETERS table, so applications
> that need to acquire routine parameter
> information at runtime must use workarounds such as parsing the output of
> SHOW CREATE statements."
> http://dev.mysql.com/doc/refman/5.0/...trictions.html


Thank you for this helpful reply!

Laurenz Albe
Reply With Quote
  #4 (permalink)  
Old 10-25-2005
Laurenz Albe
 
Posts: n/a
Default Re: query for function/procedure metadata

Giuseppe Maxia <gmax_@_cpan_._org> wrote:
> I was trying to do exactly the same thing, and I found out that the
> only viable solution, as of today, is to parse the output of
> "SHOW CREATE FUNCTION ..." in the host language.
>
> Quoting from the manual:
> "INFORMATION_SCHEMA does not yet have a PARAMETERS table, so applications
> that need to acquire routine parameter
> information at runtime must use workarounds such as parsing the output of
> SHOW CREATE statements."
> http://dev.mysql.com/doc/refman/5.0/...trictions.html


Just for the record, I find that parsing mysql.proc.param_list is easier,
though still a workaround.

Yours,
Laurenz Albe
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:21 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0