Table of Contents

Class PseudoFunctions

Namespace
LinqToDB.Internal.SqlQuery
Assembly
linq2db.dll

Contains names and create helpers for pseudo-functions, generated by linq2db and then converted to database-specific SQL by provider-specific SQL optimizer.

public static class PseudoFunctions
Inheritance
PseudoFunctions
Inherited Members

Fields

CONVERT_FORMAT

Function to convert value from one type to another: CONVERT(to_type, from_type, value) { CanBeNull = value.CanBeNull }

public const string CONVERT_FORMAT = "$Convert_Format$"

Field Value

string

LENGTH

Function for calculating length of string: LENGTH(value)

public const string LENGTH = "$Length$"

Field Value

string

MERGE_ACTION

public const string MERGE_ACTION = "$merge_action$"

Field Value

string

REMOVE_CONVERT

Function to suppress conversion SQL generation for provided value: REMOVE_CONVERT(value, resultType)

public const string REMOVE_CONVERT = "$Convert_Remover$"

Field Value

string

REPLACE

Function to replace one text fragment with another in string: REPLACE(value, oldSubstring, newSubstring)

public const string REPLACE = "$Replace$"

Field Value

string

TO_LOWER

Function to convert text parameter to lowercased form: TO_LOWER(string)

public const string TO_LOWER = "$ToLower$"

Field Value

string

TO_UPPER

Function to convert text parameter to uppercased form: TO_UPPER(string)

public const string TO_UPPER = "$ToUpper$"

Field Value

string

TRY_CONVERT

Function to convert value from one type to another: TRY_CONVERT(to_type, from_type, value) { CanBeNull = true }. Returns NULL on conversion failure.

public const string TRY_CONVERT = "$TryConvert$"

Field Value

string

TRY_CONVERT_OR_DEFAULT

Function to convert value from one type to another: TRY_CONVERT_OR_DEFAULT(to_type, from_type, value, defaultValue) { CanBeNull = value.CanBeNull || defaultValue.CanBeNull }. Returns provided default value on conversion failure.

public const string TRY_CONVERT_OR_DEFAULT = "$TryConvertOrDefault$"

Field Value

string

Methods

MakeCast(ISqlExpression, DbDataType, SqlDataType?)

Creates cast expression: CAST(value AS to_type)

public static SqlCastExpression MakeCast(ISqlExpression value, DbDataType toType, SqlDataType? fromType = null)

Parameters

value ISqlExpression
toType DbDataType
fromType SqlDataType

Returns

SqlCastExpression

MakeMandatoryCast(ISqlExpression, DbDataType, SqlDataType?)

Function to convert value from one type to another: CONVERT(to_type, from_type, value) { CanBeNull = value.CanBeNull, DoNotOptimize = true }

public static SqlCastExpression MakeMandatoryCast(ISqlExpression value, DbDataType toType, SqlDataType? fromType = null)

Parameters

value ISqlExpression
toType DbDataType
fromType SqlDataType

Returns

SqlCastExpression

MakeReplace(ISqlExpression, ISqlExpression, ISqlExpression, MappingSchema)

public static SqlFunction MakeReplace(ISqlExpression value, ISqlExpression oldSubstring, ISqlExpression newSubstring, MappingSchema mappingSchema)

Parameters

value ISqlExpression
oldSubstring ISqlExpression
newSubstring ISqlExpression
mappingSchema MappingSchema

Returns

SqlFunction

MakeToLower(ISqlExpression, MappingSchema)

public static SqlFunction MakeToLower(ISqlExpression value, MappingSchema mappingSchema)

Parameters

value ISqlExpression
mappingSchema MappingSchema

Returns

SqlFunction