SqlHelper Class |
Namespace: CMS.DataEngine
public static class SqlHelper
The SqlHelper type exposes the following members.
Name | Description | |
---|---|---|
COLUMNS_ALL |
Represents all columns within given query
| |
CommentsRegEx |
Regex matching comments within a SQL query
| |
DEFAULT_DB_SCHEMA |
Default db schema.
| |
DefaultSQLInlineLimit |
Default inline limit for SQL lists. When the number of values is below this number, the lists on SQL, e.g. IN (x, y, z), are evaluated as inline lists.
| |
GENERAL_DELETE |
General delete SQL statement
| |
GENERAL_INSERT |
General insert SQL statement
| |
GENERAL_SELECT |
General select SQL statement
| |
GENERAL_UPDATE |
General update SQL statement
| |
GENERAL_UPSERT |
General upsert (update/insert) SQL statement
| |
MAX_PARAM_LENGTH |
Maximum parameter length to log.
| |
MISSING_VALUE |
Unknown value.
| |
NO_COLUMNS |
Constant for no columns.
| |
NO_DATA_WHERE |
Where condition representing no data.
| |
NO_TOTALRECORDS |
Value for total records input to not get the total amount of data.
| |
ORDERBY_ASC |
Suffix for the ascending order
| |
ORDERBY_DESC |
Suffix for the descending order
| |
SELECT_NULL |
Empty select statement
|
Name | Description | |
---|---|---|
IntegerTableType |
Returns type for User-defined integer SQL type
| |
OrderedIntegerTableType |
Returns type for User-defined integer SQL type
| |
RunningQueries |
Counter of running queries.
|
Name | Description | |
---|---|---|
AddColumnAlias |
Adds the column alias to the given expression
| |
AddColumns |
Adds the columns.
| |
AddOrderBy |
Adds the order by to an existing one.
| |
AddWhereCondition(String, String) |
Adds where condition to the expression using AND operator.
| |
AddWhereCondition(String, String, String) |
Adds where condition to the expression.
| |
AppendQuery |
Combines the given queries with the operator
| |
ApplyOver |
Applies the over clause to the given expression
| |
BuildBigIntTable |
Gets a table-valued parameter for database calls. Is intended for usage with [Type_CMS_BigIntTable] database type.
| |
BuildGuidTable |
Gets a table-valued parameter for database calls. Is intended for usage with [Type_CMS_GuidTable] database type.
| |
BuildIntTable |
Gets a table-valued parameter for database calls. Is intended for usage with [Type_CMS_IntegerTable] database type.
| |
BuildOrderedIntTable |
Gets a table-valued parameter for database calls. Is intended for usage with [Type_CMS_OrderedIntegerTable] database type.
| |
BuildStringTable |
Gets a table-valued parameter for database calls. Is intended for usage with [Type_CMS_StringTable] database type.
| |
CombineQueries |
Combines the given queries with the operators
| |
EnsureFullName |
Ensures full name of the given column
| |
EnsureMissingColumns |
Ensures the missing columns in the given collection of QueryColumnList instances
and removes all occurrences of all columns selector in them
| |
EscapeLikeQueryPatterns |
Escapes characters for query which use LIKE pattern.
| |
EscapeLikeText |
Escapes characters for query which use LIKE pattern (%, _, [, ] and ^).
| |
EscapeQuotes |
Escapes single quotes in string value used for SQL query (value's => value''s).
| |
ExceptQueries |
Returns the query created as an EXCEPT of the given queries.
| |
GetAggregation |
Gets the aggregation expression from the given expression
| |
GetBetween |
Gets the condition matching values of the column between from and to
| |
GetCase |
Returns statement for the CASE expressions.
| |
GetCaseColumn |
Returns statement for column with case expressions.
This statement is used for evaluating a set of boolean expressions to determine the result. First case has highest priority.
| |
GetCaseOrderBy(IEnumerableString) |
Returns order by statement based on case boolean expressions. First case has highest priority.
| |
GetCaseOrderBy(String) |
Returns order by statement based on case boolean expressions. First case has highest priority.
| |
GetCast |
Get the CAST expression.
| |
GetColumnName |
Gets the column name from the given SQL column expression
| |
GetComment |
Gets a multiline SQL comment for simple input text (must not contain any open comment sequence)
| |
GetConvert |
Gets the convert expression.
| |
GetDBSchemaOrDefault |
Returns DB object scheme from settings or default value.
| |
GetIsNumeric |
Gets the ISNUMERIC expression.
| |
GetJoin |
Gets the join expression
| |
GetJoinType |
Gets the join expression
| |
GetNestedQuery |
Gets a nested query using nested SELECT for further evaluation
| |
GetOrderByColumnName(String) |
Gets the column name from the given SQL column expression
| |
GetOrderByColumnName(String, String) |
Gets the column name from the given SQL column expression
| |
GetParamCacheString |
Gets the parameters string.
| |
GetParameterName |
Gets the parameter name
| |
GetParamString |
Gets the parameters string.
| |
GetResultsString |
Gets the results as a string for log.
| |
GetRound |
Gets the round expression
| |
GetRowNumber |
Gets the row number expression
| |
GetSafeOwner |
Returns safe string representing DB owner.
| |
GetSafeQueryString(String) |
Returns safe sql query string - escapes apostrophes and escapes wildcard characters _, %, [].
| |
GetSafeQueryString(String, Boolean) |
Returns safe sql query string - escapes apostrophes and optionally escapes wildcard characters _, %, [].
| |
GetSelectQuery |
Gets the general select query
| |
GetSqlValue |
Gets the value representation for a SQL query text
| |
GetValueExpression |
Gets the value expression from the given expression
| |
GetWhereCondition(String, IEnumerableInt32, Boolean) |
Creates the where condition for the array of values.
| |
GetWhereCondition(String, IEnumerableString, Boolean) |
Creates the where condition for the array of values.
| |
GetWhereConditionT(String, IEnumerableString, Boolean, Boolean) |
Creates the where condition for the array of values.
| |
GetWhereInConditionT |
Returns where condition in SQL syntax for collection of items.
| |
HandleEmptyColumns |
Handles the empty columns constant by replacing it with empty string
| |
IntersectQueries |
Returns the query created as an INTERSECT of the given queries.
| |
IsMissing |
Returns true if the given value is missing or null.
| |
IsMissingOrNull |
Returns true if the given value is missing or null.
| |
IsSingleColumn |
Returns true, if the query output is a single column
| |
JoinColumnList |
Joins the given column list. Columns are separated by comma.
| |
MatchLikePattern |
Indicates whether string matches given SQL 'like' pattern.
| |
MergeColumns(IEnumerableString, IEnumerableString, FuncString, String, Boolean, FuncString, String) |
Merges the sets of columns and makes sure that each column in the result is present only once.
| |
MergeColumns(String, String, FuncString, String, Boolean, FuncString, String) |
Merges the sets of columns and makes sure that each column in the result is present only once.
| |
ObjectsEqual |
Returns true if two objects are equal.
| |
OrderByContains |
Returns true if the order by expression contains column sorted the specified way.
| |
ParseColumn |
Gets the column name from the given SQL column expression
| |
ParseColumnList |
Parses the given list of columns to a list (can handle also advanced columns containing functions like ISNULL(A, B) etc.).
If columns contains NO_COLUMNS, then NO_COLUMNS won't be present in result list.
| |
PreparePagedQuery |
Prepares the query for paging, adds additional system columns and updates the columns list.
| |
PreprocessQuery |
Preprocesses the give query.
| |
ProcessPagedResults |
Processes the page results - Removes the system columns and gets the total records number.
| |
QueriesEqual |
Returns true if two queries equal by their content. Ignores extra whitespaces and comments within the comparison
| |
RemoveComments |
Removes single line and simple multiline comments from a SQL query
| |
RemoveOwner |
Removes the owner from the given object name.
| |
ReverseOrderBy |
Reverses the order by string by toggling between ASC and DESC.
| |
UnionQueries(String) |
Returns the query created as an UNION ALL of given queries.
| |
UnionQueries(String, Boolean) |
Returns the query created as an UNION of the given queries.
|