public void UnQuoteAlreadyQuoted() { Assert.AreEqual( tableAlreadyQuoted[AfterUnquoteIndex], d.UnQuote(tableAlreadyQuoted[BeforeQuoteIndex])); Assert.AreEqual( tableAlreadyQuoted[AfterUnquoteIndex], d.UnQuote(tableAlreadyQuoted[AfterQuoteIndex])); }
/// <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); }
/// <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); } }