private ArrayList ParseBody(string body, string sqlMode)
        {
            bool          flag          = sqlMode.IndexOf("ANSI_QUOTES") != -1;
            bool          flag2         = sqlMode.IndexOf("NO_BACKSLASH_ESCAPES") != -1;
            string        text          = flag ? "``\"\"" : "``";
            ContextString contextString = new ContextString(text, !flag2);
            int           num           = contextString.IndexOf(body, '(');

            body = body.Substring(num + 1);
            int           num2    = this.FindRightParen(body, text);
            string        src     = body.Substring(0, num2).Trim();
            ContextString expr_71 = contextString;

            expr_71.ContextMarkers += "()";
            ArrayList arrayList = new ArrayList();

            string[] array = contextString.Split(src, ",");
            if (array.Length > 0)
            {
                string[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    string parmDef = array2[i];
                    arrayList.Add(this.ParseParameter(parmDef, contextString, sqlMode));
                }
            }
            body = body.Substring(num2 + 1).Trim().ToLower(CultureInfo.InvariantCulture);
            if (body.StartsWith("returns"))
            {
                arrayList.Add(this.ParseParameter(body, contextString, sqlMode));
            }
            return(arrayList);
        }
        private void ParseProcedureBody(DataTable parametersTable, string body,
                                        DataRow row, string nameToRestrict)
        {
            string sqlMode      = row["SQL_MODE"].ToString();
            bool   ansiQuotes   = sqlMode.IndexOf("ANSI_QUOTES") != -1;
            bool   noBackslash  = sqlMode.IndexOf("NO_BACKSLASH_ESCAPES") != -1;
            string quotePattern = ansiQuotes ? "``\"\"" : "``";

            ContextString cs = new ContextString(quotePattern, !noBackslash);

            int leftParen = cs.IndexOf(body, '(');

            Debug.Assert(leftParen != -1);

            // trim off the first part
            body = body.Substring(leftParen + 1);

            int rightParen = FindRightParen(body, quotePattern);

            Debug.Assert(rightParen != -1);
            string parms = body.Substring(0, rightParen).Trim();

            quotePattern     += "()";
            cs.ContextMarkers = quotePattern;
            string[]  paramDefs = cs.Split(parms, ",");
            ArrayList parmArray = new ArrayList(paramDefs);

            body = body.Substring(rightParen + 1).Trim().ToLower(CultureInfo.InvariantCulture);
            if (body.StartsWith("returns"))
            {
                parmArray.Add(body);
            }
            int pos = 1;

            foreach (string def in parmArray)
            {
                DataRow parmRow = parametersTable.NewRow();
                parmRow["ROUTINE_CATALOG"] = null;
                parmRow["ROUTINE_SCHEMA"]  = row["ROUTINE_SCHEMA"];
                parmRow["ROUTINE_NAME"]    = row["ROUTINE_NAME"];
                parmRow["ROUTINE_TYPE"]    = row["ROUTINE_TYPE"];
                ParseParameter(def, cs, sqlMode, parmRow);
                if (parmRow["IS_RESULT"].Equals("YES"))
                {
                    parmRow["ORDINAL_POSITION"] = 0;
                }
                else
                {
                    parmRow["ORDINAL_POSITION"] = pos++;
                }
                if (nameToRestrict == null ||
                    parmRow["PARAMETER_NAME"].ToString().ToLower() ==
                    nameToRestrict)
                {
                    parametersTable.Rows.Add(parmRow);
                }
            }
        }
        private void ParseParameter(string parmDef, ContextString cs,
                                    string sqlMode, DataRow parmRow)
        {
            parmDef = parmDef.Trim();
            string lowerDef = parmDef.ToLower(CultureInfo.InvariantCulture);

            parmRow["IS_RESULT"]      = "NO";
            parmRow["PARAMETER_MODE"] = "IN";
            if (lowerDef.StartsWith("inout "))
            {
                parmRow["PARAMETER_MODE"] = "INOUT";
                parmDef = parmDef.Substring(6);
            }
            else if (lowerDef.StartsWith("out "))
            {
                parmRow["PARAMETER_MODE"] = "OUT";
                parmDef = parmDef.Substring(4);
            }
            else if (lowerDef.StartsWith("returns "))
            {
                parmRow["PARAMETER_MODE"] = "OUT";
                parmRow["IS_RESULT"]      = "YES";
                parmDef = parmDef.Substring(8);
            }
            else if (lowerDef.StartsWith("in "))
            {
                parmDef = parmDef.Substring(3);
            }
            parmDef = parmDef.Trim();

            string[] split = cs.Split(parmDef, " \t\r\n");
            if (parmRow["IS_RESULT"].Equals("NO"))
            {
                parmRow["PARAMETER_NAME"] = String.Format("{0}{1}",
                                                          connection.ParameterMarker, CleanParameterName(split[0]));
                parmDef = parmDef.Substring(split[0].Length);
            }
            else
            {
                lowerDef = parmDef.ToLower(CultureInfo.InvariantCulture);
                parmDef  = parmDef.Substring(0, lowerDef.IndexOf("begin"));
                parmRow["PARAMETER_NAME"] = String.Format("{0}RETURN_VALUE",
                                                          connection.ParameterMarker);
            }

            ParseType(parmDef, sqlMode, parmRow);
        }
        private MySqlParameter ParseParameter(string parmDef, ContextString cs, string sqlMode)
        {
            MySqlParameter mySqlParameter = new MySqlParameter();

            parmDef = parmDef.Trim();
            string text = parmDef.ToLower(CultureInfo.InvariantCulture);

            if (text.StartsWith("inout "))
            {
                mySqlParameter.Direction = (ParameterDirection)3;
                parmDef = parmDef.Substring(6);
            }
            else if (text.StartsWith("in "))
            {
                parmDef = parmDef.Substring(3);
            }
            else if (text.StartsWith("out "))
            {
                mySqlParameter.Direction = (ParameterDirection)2;
                parmDef = parmDef.Substring(4);
            }
            else if (text.StartsWith("returns "))
            {
                mySqlParameter.Direction = (ParameterDirection)6;
                parmDef = parmDef.Substring(8);
            }
            parmDef = parmDef.Trim();
            string[] array = cs.Split(parmDef, " \t\r\n");
            if ((int)mySqlParameter.Direction != 6)
            {
                mySqlParameter.ParameterName = string.Format("{0}{1}", this.connection.ParameterMarker, this.CleanParameterName(array[0], false));
                parmDef = parmDef.Substring(array[0].Length);
            }
            else
            {
                text    = parmDef.ToLower(CultureInfo.InvariantCulture);
                parmDef = parmDef.Substring(0, text.IndexOf("begin"));
                mySqlParameter.ParameterName = string.Format("{0}RETURN_VALUE", this.connection.ParameterMarker);
            }
            this.ParseType(parmDef, sqlMode, mySqlParameter);
            return(mySqlParameter);
        }