예제 #1
0
파일: Alias.cs 프로젝트: ImanRezaeipour/GTS
        /// <summary>
        ///
        /// </summary>
        /// <param name="sqlIdentifier"></param>
        /// <param name="dialect"></param>
        /// <returns></returns>
        public string ToAliasString(string sqlIdentifier, Dialect.Dialect dialect)
        {
            bool   isQuoted = dialect.IsQuoted(sqlIdentifier);
            string unquoted;

            if (isQuoted)
            {
                unquoted = dialect.UnQuote(sqlIdentifier);
            }
            else
            {
                unquoted = sqlIdentifier;
            }

            // Oracle doesn't like underscores at the start of identifiers (NH-320).
            // It should be safe to trim them here, because the aliases are postfixed
            // with a unique number anyway, so they won't collide.
            unquoted = unquoted.TrimStart('_');

            if (unquoted.Length > length)
            {
                unquoted = unquoted.Substring(0, length);
            }

            if (suffix != null)
            {
                unquoted += suffix;
            }

            if (isQuoted)
            {
                return(dialect.QuoteForAliasName(unquoted));
            }
            else
            {
                return(unquoted);
            }
        }
예제 #2
0
 public void IsQuotedTrue()
 {
     Assert.IsTrue(d.IsQuoted(tableAlreadyQuoted[BeforeQuoteIndex]));
 }