C# Class Hd.QueryExtensions.SqlExpression

ファイルを表示 Open project: TargetProcess/Tp.HelpDesk Class Usage Examples

Public Methods

Method Description
Constant ( SqlConstant val ) : SqlExpression

Creates a SqlExpression which represents a constant typed value.

Constant ( SqlDataType dataType, object val ) : SqlExpression

Creates a SqlExpression which represents a constant typed value

Date ( System.DateTime val ) : SqlExpression

Creates a SqlExpression which represents a date value.

Field ( Enum fieldName ) : SqlExpression
Field ( Enum firstPart, Enum secondPart, FromTerm table ) : SqlExpression
Field ( Enum fieldName, FromTerm table ) : SqlExpression
Field ( string fieldName ) : SqlExpression

Creates a SqlExpression which represents a field in a database table.

Field ( string fieldName, FromTerm table ) : SqlExpression

Creates a SqlExpression which represents a field in a database table.

Function ( SqlAggregationFunction func, SqlExpression param ) : SqlExpression

Creates a SqlExpression with an aggergation function

IfNull ( SqlExpression test, SqlExpression val ) : SqlExpression

Creates a SqlExpression with IfNull function.

Works as SQL Server's ISNULL() function.

LikeExpressionParameter ( ) : SqlExpression
LikeExpressionParameter ( Enum paramName ) : SqlExpression
LikeExpressionParameter ( string paramName ) : SqlExpression
Null ( ) : SqlExpression

Creates a SqlExpression representing a NULL value

Number ( double val ) : SqlExpression

Creates a SqlExpression which represents a numeric value.

Number ( int val ) : SqlExpression

Creates a SqlExpression which represents a numeric value.

Parameter ( ) : SqlExpression
Parameter ( string paramName ) : SqlExpression Correct parameter name depends on your specifc data provider. OLEDB expects all parameters to be '?' and matches parameters to values based on their index. SQL Server Native driver matches parameters by names and expects to find "@paramName" parameter placeholder in the query.
PseudoField ( string fieldName ) : SqlExpression
Raw ( string sql ) : SqlExpression

Creates a SqlExpression with raw SQL

String ( string val ) : SqlExpression

Creates a SqlExpression which represents a textual value.

SubQuery ( SelectQuery query ) : SqlExpression

Creates a SqlExpression which represents a subquery.

SubQuery ( string queryText ) : SqlExpression

Creates a SqlExpression which represents a subquery.

In many cases you can use an inner or outer JOIN instead of a subquery. If you prefer using subqueries it is recomended that you construct the subquery using another instance of SelectQuery, render it using the correct renderer and pass the resulting SQL statement to the queryText parameter.

Private Methods

Method Description
SqlExpression ( ) : System

Method Details

Constant() public static method

Creates a SqlExpression which represents a constant typed value.
public static Constant ( SqlConstant val ) : SqlExpression
val SqlConstant SqlConstant instance
return SqlExpression

Constant() public static method

Creates a SqlExpression which represents a constant typed value
public static Constant ( SqlDataType dataType, object val ) : SqlExpression
dataType SqlDataType Value's data type
val object The value
return SqlExpression

Date() public static method

Creates a SqlExpression which represents a date value.
public static Date ( System.DateTime val ) : SqlExpression
val System.DateTime Value of the expression
return SqlExpression

Field() public static method

public static Field ( Enum fieldName ) : SqlExpression
fieldName System.Enum
return SqlExpression

Field() public static method

public static Field ( Enum firstPart, Enum secondPart, FromTerm table ) : SqlExpression
firstPart System.Enum
secondPart System.Enum
table FromTerm
return SqlExpression

Field() public static method

public static Field ( Enum fieldName, FromTerm table ) : SqlExpression
fieldName System.Enum
table FromTerm
return SqlExpression

Field() public static method

Creates a SqlExpression which represents a field in a database table.
public static Field ( string fieldName ) : SqlExpression
fieldName string Name of a field
return SqlExpression

Field() public static method

Creates a SqlExpression which represents a field in a database table.
public static Field ( string fieldName, FromTerm table ) : SqlExpression
fieldName string Name of a field
table FromTerm The table this field belongs to
return SqlExpression

Function() public static method

Creates a SqlExpression with an aggergation function
public static Function ( SqlAggregationFunction func, SqlExpression param ) : SqlExpression
func SqlAggregationFunction Aggregation function to be applied on the supplied expression
param SqlExpression Parameter of the aggregation function
return SqlExpression

IfNull() public static method

Creates a SqlExpression with IfNull function.
Works as SQL Server's ISNULL() function.
public static IfNull ( SqlExpression test, SqlExpression val ) : SqlExpression
test SqlExpression Expression to be checked for being NULL
val SqlExpression Substitution
return SqlExpression

LikeExpressionParameter() public static method

public static LikeExpressionParameter ( ) : SqlExpression
return SqlExpression

LikeExpressionParameter() public static method

public static LikeExpressionParameter ( Enum paramName ) : SqlExpression
paramName System.Enum
return SqlExpression

LikeExpressionParameter() public static method

public static LikeExpressionParameter ( string paramName ) : SqlExpression
paramName string
return SqlExpression

Null() public static method

Creates a SqlExpression representing a NULL value
public static Null ( ) : SqlExpression
return SqlExpression

Number() public static method

Creates a SqlExpression which represents a numeric value.
public static Number ( double val ) : SqlExpression
val double Value of the expression
return SqlExpression

Number() public static method

Creates a SqlExpression which represents a numeric value.
public static Number ( int val ) : SqlExpression
val int Value of the expression
return SqlExpression

Parameter() public static method

public static Parameter ( ) : SqlExpression
return SqlExpression

Parameter() public static method

Correct parameter name depends on your specifc data provider. OLEDB expects all parameters to be '?' and matches parameters to values based on their index. SQL Server Native driver matches parameters by names and expects to find "@paramName" parameter placeholder in the query.
public static Parameter ( string paramName ) : SqlExpression
paramName string
return SqlExpression

PseudoField() public static method

public static PseudoField ( string fieldName ) : SqlExpression
fieldName string
return SqlExpression

Raw() public static method

Creates a SqlExpression with raw SQL
public static Raw ( string sql ) : SqlExpression
sql string
return SqlExpression

String() public static method

Creates a SqlExpression which represents a textual value.
public static String ( string val ) : SqlExpression
val string Value of the expression
return SqlExpression

SubQuery() public static method

Creates a SqlExpression which represents a subquery.
public static SubQuery ( SelectQuery query ) : SqlExpression
query SelectQuery A SelectQuery object
return SqlExpression

SubQuery() public static method

Creates a SqlExpression which represents a subquery.
In many cases you can use an inner or outer JOIN instead of a subquery. If you prefer using subqueries it is recomended that you construct the subquery using another instance of SelectQuery, render it using the correct renderer and pass the resulting SQL statement to the queryText parameter.
public static SubQuery ( string queryText ) : SqlExpression
queryText string Text of the subquery.
return SqlExpression