EFIngresProvider/EFIngresProviderManifest.cs
/// <summary>
/// Function to detect wildcard characters '%' and '_' and escape them with a preceding \
/// This escaping is used when StartsWith, EndsWith and Contains canonical and CLR functions
/// are translated to their equivalent LIKE expression
/// </summary>
/// <param name="text">Original input as specified by the user</param>
/// <param name="alwaysEscapeEscapeChar">escape the escape character \ regardless whether wildcard 
/// characters were encountered </param>
/// <param name="usedEscapeChar">true if the escaping was performed, false if no escaping was required</param>
/// <returns>The escaped string that can be used as pattern in a LIKE expression</returns>
Function to detect wildcard characters '%' and '_' and escape them with a preceding \
This escaping is used when StartsWith, EndsWith and Contains canonical and CLR functions
are translated to their equivalent LIKE expression
Function to detect wildcard characters ' % ' and ' _ ' and escape them with a preceding \ This escaping is used when StartsWith EndsWith and Contains canonical and CLR functions are translated to their equivalent LIKE expression
internal static string EscapeLikeText(string text, bool alwaysEscapeEscapeChar, out bool usedEscapeChar)
        {
            usedEscapeChar = false;
            if (!(text.Contains("%") || text.Contains("_") || alwaysEscapeEscapeChar && text.Contains(LikeEscapeCharString)))
            {
                return text;
            }
            var sb = new StringBuilder(text.Length);
            foreach (char c in text)
            {
                if (c == '%' || c == '_' || c == LikeEscapeChar)
                {
                    sb.Append(LikeEscapeChar);
                    usedEscapeChar = true;
                }
                sb.Append(c);
            }
            return sb.ToString();
        }
internal static string EscapeLikeText ( string text , bool alwaysEscapeEscapeChar , out bool usedEscapeChar ) { usedEscapeChar = false ; if ( ! ( text . Contains ( " " ) || text . Contains ( " " ) || alwaysEscapeEscapeChar && text . Contains ( LikeEscapeCharString ) ) ) { return text ; } var sb = new StringBuilder ( text . Length ) ; foreach ( char c in text ) { if ( c == ' ' || c == ' ' || c == LikeEscapeChar ) { sb . Append ( LikeEscapeChar ) ; usedEscapeChar = true ; } sb . Append ( c ) ; } return sb . ToString ( ) ; }
Function to detect wildcard characters '%' and '_' and escape them with a preceding \
This escaping is used when StartsWith, EndsWith and Contains canonical and CLR functions
are translated to their equivalent LIKE expression
Function to detect wildcard characters ' % ' and ' _ ' and escape them with a preceding \ This escaping is used when StartsWith EndsWith and Contains canonical and CLR functions are translated to their equivalent LIKE expression
The escaped string that can be used as pattern in a LIKE expression
The escaped string that can be used as pattern in a LIKE expression
text
string
Original input as specified by the user
Original input as specified by the user
alwaysEscapeEscapeChar
bool
escape the escape character \ regardless whether wildcard
characters were encountered
escape the escape character \ regardless whether wildcard characters were encountered
bool
out
usedEscapeChar
true if the escaping was performed, false if no escaping was required
true if the escaping was performed false if no escaping was required