/// <summary> /// Attempts to match the sql to the pattern. If successful, sets the type and name /// </summary> /// <param name="sql">The sql to parse</param> /// <param name="type">If matched, updated to the current type</param> /// <param name="name">If matched, updated to the name</param> /// <returns></returns> public SqlParserMatch Match(string sql) { Match match = _regex.Match(sql); if (match.Success) { SqlParserMatch parserMatch = new SqlParserMatch() { SchemaObjectType = this.SchemaObjectType, Position = match.Index }; // for the unused crud, there is no additional parsing. if (SchemaObjectType != Schema.SchemaObjectType.Unused) { string name = match.Result(_nameTemplate); // return a match parserMatch.Name = name; } return(parserMatch); } return(null); }
/// <summary> /// Attempts to match the sql to the pattern. If successful, sets the type and name /// </summary> /// <param name="sql">The sql to parse</param> /// <param name="type">If matched, updated to the current type</param> /// <param name="name">If matched, updated to the name</param> /// <returns></returns> public SqlParserMatch Match(string sql) { Match match = _regex.Match(sql); if (match.Success) { SqlParserMatch parserMatch = new SqlParserMatch() { SchemaObjectType = this.SchemaObjectType, Position = match.Index }; // for the unused crud, there is no additional parsing. if (SchemaObjectType != Schema.SchemaObjectType.Unused) { string name = match.Result(_nameTemplate); // return a match parserMatch.Name = name; } return parserMatch; } return null; }