public void VisitRule(TextReader txtRdr, TSqlFragmentVisitor visitor) { IList <ParseError> errors; var sqlFragment = GetFragment(txtRdr, out errors); sqlFragment.Accept(visitor); }
public static TSqlScript AnalyzeFragmentVisitor(string tSql, string sqlHash, TSqlFragmentVisitor visitor) { var sqlFragment = SqlFragmentProvider.GetSqlFragment(tSql, sqlHash); if (sqlFragment == null) { throw new InvalidOperationException(string.Format("Failed to get sqlFragment of \n{0}", tSql)); } sqlFragment.Accept(visitor); return sqlFragment; }
public static TSqlScript AnalyzeFragmentVisitor(string tSql, string sqlHash, TSqlFragmentVisitor visitor) { var sqlFragment = SqlFragmentProvider.GetSqlFragment(tSql, sqlHash); if (sqlFragment == null) { throw new InvalidOperationException(string.Format("Failed to get sqlFragment of \n{0}", tSql)); } sqlFragment.Accept(visitor); return(sqlFragment); }
private static bool VisitorIsBlackListedForDynamicSql(TSqlFragmentVisitor visitor) { if (visitor == null) { return(false); } return(new List <string> { "SetAnsiNullsRule", "SetNoCountRule", "SetQuotedIdentifierRule", "SetTransactionIsolationLevelRule", "UnicodeStringRule" }.Any(x => visitor.GetType().ToString().Contains(x))); }
private void VisitFragment(TSqlFragment sqlFragment, TSqlFragmentVisitor visitor, IEnumerable <IOverride> overrides) { sqlFragment?.Accept(visitor); if (!VisitorIsBlackListedForDynamicSql(visitor)) { var dynamicSqlVisitor = new DynamicSQLParser(DynamicSqlCallback); sqlFragment?.Accept(dynamicSqlVisitor); } void DynamicSqlCallback(string dynamicSQL, int DynamicSqlStartLine, int DynamicSqlStartColumn) { ((ISqlRule)visitor).DynamicSqlStartLine = DynamicSqlStartLine; ((ISqlRule)visitor).DynamicSqlStartColumn = DynamicSqlStartColumn; var dynamicSqlStream = ParsingUtility.GenerateStreamFromString(dynamicSQL); var dynamicFragment = fragmentBuilder.GetFragment(GetSqlTextReader(dynamicSqlStream), out var errors, overrides); dynamicFragment?.Accept(visitor); } }
public ScriptParser(TSqlFragmentVisitor visitor, string path) { _visitor = visitor; _path = path; }
public static void AnalyzeFragmentVisitor(string tSql, string sqlHash, TSqlFragmentVisitor visitor) { var sqlFragment = SqlFragmentProvider.GetSqlFragment(tSql, sqlHash); sqlFragment.Accept(visitor); }
public ScriptParser(TSqlFragmentVisitor visitor, string path) { _visitor = visitor; _path = path; }