//=========================================================================================
 public WhereSuggestionBuilder(CodeViewer viewer, IDbInfoProvider infoProvider, string schema, string table)
     : base(viewer)
 {
     this.InfoProvider = infoProvider;
     this.Schema       = schema;
     this.Table        = table;
 }
		//=========================================================================================
		public EditQueryRegExBuilder(CodeViewer viewer, IDbInfoProvider infoProvider)
			: base(viewer)
		{
			this.Keywords = new List<string> { "WHERE", "SELECT", "JOIN", "ORDER", "FROM", "AS", "UPDATE", "SET" };

			this.InfoProvider = infoProvider;
			this.DefaultSchema = "dbo";

			string sWordDefinition;
			const string sWordPattern = @"(?:\w+|{0}.*?{1})";
			switch (this.Viewer.Language)
			{
				case PredefinedLanguage.MySql:
					sWordDefinition = String.Format(sWordPattern, "`", "`");
					break;

				case PredefinedLanguage.Oracle:
				case PredefinedLanguage.Access:
					sWordDefinition = String.Format(sWordPattern, "\"", "\"");
					break;

				case PredefinedLanguage.MsSql:
				default:
					sWordDefinition = String.Format(sWordPattern, @"\[", @"\]");
					break;
			}

			const string sFromJoinDefinition = @"(?:from|join|update)\s+";
			string sRegexDefinition = string.Format(
				@"(?<source>(?:(?<schema>{0})\s*\.\s*)?(?<table>{0})(?:\s*(?:AS)?\s*(?<alias>{0}))?)", sWordDefinition);
			string sRegexMultiple = string.Format(@"{0}{1}(?:\s*,\s*{1})*", sFromJoinDefinition, sRegexDefinition);
			this.RegexSources = new Regex(sRegexMultiple, RegexOptions.IgnoreCase);
		}
		//=========================================================================================
		public WhereSuggestionBuilder(CodeViewer viewer, IDbInfoProvider infoProvider, string schema, string table)
			: base(viewer)
		{
			this.InfoProvider = infoProvider;
			this.Schema = schema;
			this.Table = table;
		}
示例#4
0
        //=========================================================================================
        public EditQueryRegExBuilder(CodeViewer viewer, IDbInfoProvider infoProvider)
            : base(viewer)
        {
            this.Keywords = new List <string> {
                "WHERE", "SELECT", "JOIN", "ORDER", "FROM", "AS", "UPDATE", "SET"
            };

            this.InfoProvider  = infoProvider;
            this.DefaultSchema = "dbo";

            string       sWordDefinition;
            const string sWordPattern = @"(?:\w+|{0}.*?{1})";

            switch (this.Viewer.Language)
            {
            case PredefinedLanguage.MySql:
                sWordDefinition = String.Format(sWordPattern, "`", "`");
                break;

            case PredefinedLanguage.Oracle:
            case PredefinedLanguage.Access:
                sWordDefinition = String.Format(sWordPattern, "\"", "\"");
                break;

            case PredefinedLanguage.MsSql:
            default:
                sWordDefinition = String.Format(sWordPattern, @"\[", @"\]");
                break;
            }

            const string sFromJoinDefinition = @"(?:from|join|update)\s+";
            string       sRegexDefinition    = string.Format(
                @"(?<source>(?:(?<schema>{0})\s*\.\s*)?(?<table>{0})(?:\s*(?:AS)?\s*(?<alias>{0}))?)", sWordDefinition);
            string sRegexMultiple = string.Format(@"{0}{1}(?:\s*,\s*{1})*", sFromJoinDefinition, sRegexDefinition);

            this.RegexSources = new Regex(sRegexMultiple, RegexOptions.IgnoreCase);
        }