MySQL Forums
Forum List  »  Stored Procedures

Re: how to retreive the parameters of the stored procedures fro information_schema
Posted by: Emma Middlebrook
Date: January 25, 2006 07:13AM

In my application, which is c# the mysql connector has a function called DeriveParameters(). This function basically goes off to the database and asks it what parameters are required for a specific stored procedure. I then cache the parameter details in my application so that I don't ahve to keep going to the database everytime I want to execute a stored procedure.

Here's a sample of the code, maybe you have a similar function that you can use in your java app?

using (MySqlCommand cmd = new MySqlCommand(spName,connection))
{
cmd.CommandType = CommandType.StoredProcedure;
try
{
MySqlCommandBuilder.DeriveParameters(cmd);
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
throw ex;
}
catch (Exception e)
{
throw e;
}

MySqlParameter[] discoveredParameters = new MySqlParameter[cmd.Parameters.Count];
cmd.Parameters.CopyTo(discoveredParameters, 0);
return discoveredParameters;
}

HTH,

Emma

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: how to retreive the parameters of the stored procedures fro information_schema
1232
January 25, 2006 07:13AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.