public override void SetUp()
		{
			// Generic Dialect inherits all of the Quoting functions from
			// Dialect (which is abstract)
			d = new MsSql2000Dialect();
			tableWithNothingToBeQuoted = new string[] {"plainname", "[plainname]"};
			tableAlreadyQuoted = new string[] {"[Quote[d[Na]]$`]", "[Quote[d[Na]]$`]", "Quote[d[Na]$`"};
			tableThatNeedsToBeQuoted = new string[] {"Quote[d[Na]$`", "[Quote[d[Na]]$`]", "Quote[d[Na]$`"};
		}
		public void OrderByMultiColumn()
		{
			Dialect.Dialect dialect = new MsSql2000Dialect();

			string orderBy = "col1 asc, col2 desc, col3";
			string expectedOrderBy = "$PlaceHolder$.col1 asc, $PlaceHolder$.col2 desc, $PlaceHolder$.col3";

			Assert.AreEqual(expectedOrderBy, Template.RenderOrderByStringTemplate(orderBy, dialect, functionRegistry));
		}
		public void SchemaNameQuoted()
		{
			Table tbl = new Table();
			tbl.Schema = "`schema`";
			tbl.Name = "name";

			Dialect.Dialect dialect = new MsSql2000Dialect();

			Assert.AreEqual("[schema].name", tbl.GetQualifiedName(dialect));
		}
		public void NoLeadingUnderscores()
		{
			Alias alias = new Alias("suffix");
			Dialect.Dialect dialect = new MsSql2000Dialect();

			Assert.IsFalse(
				alias.ToAliasString("__someIdentifier", dialect)
					.StartsWith("_"));

			Assert.IsFalse(
				alias.ToUnquotedAliasString("__someIdentifier", dialect)
					.StartsWith("_"));
		}
Exemple #5
0
            public LockHintAppender(MsSql2000Dialect dialect, IDictionary <string, LockMode> aliasedLockModes)
            {
                _dialect          = dialect;
                _aliasedLockModes = aliasedLockModes;

                // Regex matching any alias out of those given. Aliases should contain
                // no dangerous characters (they are identifiers) so they are not escaped.
                var aliasesPattern = StringHelper.Join("|", aliasedLockModes.Keys);

                // Match < alias >, < alias,>, or < alias$>, the intent is to capture alias names
                // in various kinds of "FROM table1 alias1, table2 alias2".
                _matchRegex         = new Regex(" (" + aliasesPattern + ")([, ]|$)");
                _unionSubclassRegex = new Regex(@"from\s+\(((?:.|\r|\n)*)\)(?:\s+as)?\s+(?<alias>" + aliasesPattern + ")", RegexOptions.IgnoreCase | RegexOptions.Multiline);
            }
		public void TableNameNotQuoted()
		{
			Table tbl = new Table();
			tbl.Name = "notkeyword";

			Dialect.Dialect dialect = new MsSql2000Dialect();

			Assert.AreEqual("notkeyword", tbl.GetQuotedName(dialect));

			Assert.AreEqual("dbo.notkeyword", tbl.GetQualifiedName(dialect, null, "dbo"));

			Assert.AreEqual("notkeyword", tbl.GetQualifiedName(dialect, null, null));

			tbl.Schema = "sch";

			Assert.AreEqual("sch.notkeyword", tbl.GetQualifiedName(dialect));
		}
			public LockHintAppender(MsSql2000Dialect dialect, IDictionary<string, LockMode> aliasedLockModes)
			{
				this.dialect = dialect;
				this.aliasedLockModes = aliasedLockModes;
			}
			public LockHintAppender(MsSql2000Dialect dialect, IDictionary<string, LockMode> aliasedLockModes)
			{
				_dialect = dialect;
				_aliasedLockModes = aliasedLockModes;

				// Regex matching any alias out of those given. Aliases should contain
				// no dangerous characters (they are identifiers) so they are not escaped.
				var aliasesPattern = StringHelper.Join("|", aliasedLockModes.Keys);

				// Match < alias >, < alias,>, or < alias$>, the intent is to capture alias names
				// in various kinds of "FROM table1 alias1, table2 alias2".
				_matchRegex = new Regex(" (" + aliasesPattern + ")([, ]|$)");
				_unionSubclassRegex = new Regex(@"from\s+\(((?:.|\r|\n)*)\)(?:\s+as)?\s+(?<alias>" + aliasesPattern + ")", RegexOptions.IgnoreCase | RegexOptions.Multiline);
	}
 public LockHintAppender(MsSql2000Dialect dialect, IDictionary <string, LockMode> aliasedLockModes)
 {
     this.dialect          = dialect;
     this.aliasedLockModes = aliasedLockModes;
 }