コード例 #1
0
        public void UnQuoteAlreadyQuoted()
        {
            Assert.AreEqual(
                tableAlreadyQuoted[AfterUnquoteIndex],
                d.UnQuote(tableAlreadyQuoted[BeforeQuoteIndex]));

            Assert.AreEqual(
                tableAlreadyQuoted[AfterUnquoteIndex],
                d.UnQuote(tableAlreadyQuoted[AfterQuoteIndex]));
        }
コード例 #2
0
ファイル: Alias.cs プロジェクト: ImanRezaeipour/GTS
        /// <summary>
        ///
        /// </summary>
        /// <param name="sqlIdentifier"></param>
        /// <param name="dialect"></param>
        /// <returns></returns>
        public string ToUnquotedAliasString(string sqlIdentifier, Dialect.Dialect dialect)
        {
            string unquoted = dialect.UnQuote(sqlIdentifier);

            // See comment in ToAliasString above
            unquoted = unquoted.TrimStart('_');

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

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

            return(unquoted);
        }
コード例 #3
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);
            }
        }