public static void DeriveParameters(MySqlCommand command)
        {
            if (command.CommandType != CommandType.StoredProcedure)
            {
                throw new InvalidOperationException(Resources.CanNotDeriveParametersForTextCommands);
            }
            string text = command.CommandText;

            if (text.IndexOf(".") == -1)
            {
                text = command.Connection.Database + "." + text;
            }
            try
            {
                ProcedureCacheEntry procedure = command.Connection.ProcedureCache.GetProcedure(command.Connection, text, null);
                command.Parameters.Clear();
                foreach (MySqlSchemaRow current in procedure.parameters.Rows)
                {
                    MySqlParameter mySqlParameter = new MySqlParameter();
                    mySqlParameter.ParameterName = string.Format("@{0}", current["PARAMETER_NAME"]);
                    if (current["ORDINAL_POSITION"].Equals(0) && mySqlParameter.ParameterName == "@")
                    {
                        mySqlParameter.ParameterName = "@RETURN_VALUE";
                    }
                    mySqlParameter.Direction = MySqlCommandBuilder.GetDirection(current);
                    bool unsigned    = StoredProcedure.GetFlags(current["DTD_IDENTIFIER"].ToString()).IndexOf("UNSIGNED") != -1;
                    bool realAsFloat = procedure.procedure.Rows[0]["SQL_MODE"].ToString().IndexOf("REAL_AS_FLOAT") != -1;
                    mySqlParameter.MySqlDbType = MetaData.NameToType(current["DATA_TYPE"].ToString(), unsigned, realAsFloat, command.Connection);
                    if (current["CHARACTER_MAXIMUM_LENGTH"] != null)
                    {
                        mySqlParameter.Size = (int)current["CHARACTER_MAXIMUM_LENGTH"];
                    }
                    if (current["NUMERIC_PRECISION"] != null)
                    {
                        mySqlParameter.Precision = Convert.ToByte(current["NUMERIC_PRECISION"]);
                    }
                    if (current["NUMERIC_SCALE"] != null)
                    {
                        mySqlParameter.Scale = Convert.ToByte(current["NUMERIC_SCALE"]);
                    }
                    if (mySqlParameter.MySqlDbType == MySqlDbType.Set || mySqlParameter.MySqlDbType == MySqlDbType.Enum)
                    {
                        mySqlParameter.PossibleValues = MySqlCommandBuilder.GetPossibleValues(current);
                    }
                    command.Parameters.Add(mySqlParameter);
                }
            }
            catch (InvalidOperationException ex)
            {
                throw new MySqlException(Resources.UnableToDeriveParameters, ex);
            }
        }