SqlFunctions

Ecng.Data.Sql

Provides SQL functions usable from a query.

Methods

IfNull
public static string IfNull(string s, string what)
result = SqlFunctions.IfNull(s, what)

SQL IFNULL (COALESCE) function for strings.

s
Value.
what
What to answer with when the value is null.

Returns: The value, or when it is null.

IsNull``1
public static T IsNull<T>(T s, T what)
result = SqlFunctions.IsNull(s, what)

SQL ISNULL (COALESCE) function for generic types.

s
Value.
what
What to answer with when the value is null.

Returns: The value, or when it is null.

Like
public static bool Like(string s, string what)
result = SqlFunctions.Like(s, what)

SQL LIKE pattern matching operator.

s
Value to compare.
what
Pattern, where % stands for any run of characters, _ for one, and [...] for a character class.

Returns: Whether the value matches the pattern. A null on either side matches nothing, as a comparison against NULL leaves the row out.

LikeEscaped
public static bool LikeEscaped(string s, string what)
result = SqlFunctions.LikeEscaped(s, what)

SQL LIKE pattern matching operator with an explicit ESCAPE clause, so a pattern built by String) matches the caller's text literally. Use this whenever the pattern comes from user input.

s
Value to compare.
what
Pattern whose metacharacters are escaped with EscapeChar.

Returns: Whether the value matches the pattern.