public static IAsyncResult StartWork(string source, TableAliasType aliasType, AsyncCallback callback, object state) { SqlTableAliasesWorkItem result = new SqlTableAliasesWorkItem(source, aliasType, callback, state); ThreadPool.QueueUserWorkItem(ThreadPool_WaitCallback, result); return(result); }
public SqlTableAliasesWorkItem(string source, TableAliasType aliasType, AsyncCallback callback, object state) { this._source = source; this._callback = callback; this._asyncState = state; this._aliasType = aliasType; this._waitHandle = new ManualResetEvent(this._completedSynchronously); }
public IDictionary <string, SqlTableAlias> GetTableAliases(string sqlText, TableAliasType aliasType) { IDictionary <string, SqlTableAlias> result = new Dictionary <string, SqlTableAlias>(); string expression = String.Empty; switch (aliasType) { case TableAliasType.From: expression = ResManager.GetRegularExpression("SqlAnalyze_TableAliasFrom"); break; case TableAliasType.Join: expression = ResManager.GetRegularExpression("SqlAnalyze_TableAliasJoin"); break; default: return(result); } Match m; SqlTableAlias ta = null; Group g = null; for (m = Regex.Match(sqlText, expression, RegexOptions.IgnoreCase); m.Success; m = m.NextMatch()) { g = m.Groups["TableName"]; if (g == null) { continue; } string tName = SqlAnalyzeHelper.CleanIdentifier(g.Value); if (tName.Contains("(") || tName.Contains(")")) { continue; } tName = SqlAnalyzeHelper.MatchTableName(tName); if (result.ContainsKey(tName)) { continue; } if (ShallIgnore(m)) { continue; } ta = new SqlTableAlias(aliasType); ta.TableName = tName; result.Add(ta.TableName, ta); g = m.Groups["TableAlias"]; if (g != null) { if (SqlAnalyzeHelper.CleanIdentifier(g.Value).Trim() == "on") { ta.TableAlias = ta.TableName; } else { ta.TableAlias = SqlAnalyzeHelper.CleanIdentifier(g.Value); } } } return(result); }
public static IAsyncResult StartWork(string source, TableAliasType aliasType, AsyncCallback callback) { return(StartWork(source, aliasType, callback, null)); }
public SqlTableAlias(TableAliasType aliasType) { _aliasType = aliasType; }