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); } } }