Creatio development guide
PDF
This documentation is valid for Creatio version 7.16.0. We recommend using the newest version of Creatio documentation.

The Update class

Glossary Item Box

Introduction

The Terrasoft.Core.DB.Update class is used to build queries for modifying records in Creatio database tables. As a result of creating and configuring the instance of this class, the UPDATE SQL-expression query to the application database will be built.

The “Terrasoft.Core.DB.Update” class

Use the “.NET class libraries of platform core” documentation to access the full list of the methods and properties, parent classes, and implemented interfaces of the Update class.

Constructors

public Update((UserConnection userConnection))
Creates a class instance using UserConnection.
public Update((UserConnection userConnection, string schemaName))
Creates a class instance for the specified schema using UserConnection.
public Update((UserConnection userConnection, ModifyQuerySource source))
Creates a class instance for the specified data source using UserConnection.
public Update((Insert source))
Creates a class instance that is a clone of the instance passed as an argument.

Properties

Table 1. Primary properties of the class

UserConnection
Terrasoft.Core.UserConnection
The current user connection at the moment of executing the query.
Condition
Terrasoft.Core.DB.QueryCondition
Condition of Where expression in the query.
HasCondition
bool
Determines whether Where expression is available in the query.
Source.
Terrasoft.Core.DB.ModifyQuerySource
The query data source.
ColumnValues
Terrasoft.Core.DB.ModifyQueryColumnValueCollection
Collection of values of the query columns.

Methods

Table 2. Primary methods of the class

string GetSqlText(())
Returns the SQL text of the current query.
void BuildSqlText((StringBuilder sb))
Generates the query text via the StringBuilder instance.
void ResetCachedSqlText(())
Clears the cached text of the query.
QueryParameterCollection GetUsingParameters(())
Returns the collection of parameters used by the query.
int Execute(())
Executes the query. Returns the number of records involved by the query.
int Execute(DBExecutor dbExecutor))
Executes the query using the DBExecutor instance. Returns the number of records involved by the query.
QueryCondition Where())
QueryCondition Where(string sourceColumnAlias))
QueryCondition Where(string sourceAlias, string sourceColumnAlias))
QueryCondition Where(Select subSelect))
QueryCondition Where(Query subSelectQuery))
QueryCondition Where(QueryColumnExpression columnExpression))
Query Where(QueryCondition condition))

Adds the initial condition to the current query.

Parameters:

  • sourceColumnAlias – an alias of the column for which the condition is added;
  • sourceAlias – the alias of the source;
  • subSelect – a subquery of the data selection, for whose results the condition is added;
  • subSelectQuery – the subquery, for whose results the condition is added;
  • columnExpression – the expression, for whose results the condition is added;
  • condition – the query condition.

QueryCondition And(())
QueryCondition And((string sourceColumnAlias))
QueryCondition And((string sourceAlias, string sourceColumnAlias))
QueryCondition And((Select subSelect))
QueryCondition And((Query subSelectQuery))
QueryCondition And((QueryParameter parameter))
QueryCondition And((QueryColumnExpression columnExpression))
Query And((QueryCondition condition))

Adds the condition (predicate) to the current query condition using the AND logical operation.

Parameters:

  • sourceColumnAlias – an alias of the column, for which the predicate is added;
  • sourceAlias – the alias of the source;
  • subSelect – the data selection subquery used as a predicate;
  • subSelectQuery – the subquery used as a predicate;
  • parameter – parameter that the predicate is added to;
  • columnExpression – the expression used as a predicate;
  • condition – the query condition.

QueryCondition Or(())
QueryCondition Or((string sourceColumnAlias))
QueryCondition Or((string sourceAlias, string sourceColumnAlias))
QueryCondition Or((Select subSelect))
QueryCondition Or((Query subSelectQuery))
QueryCondition Or((QueryParameter parameter))
QueryCondition Or((QueryColumnExpression columnExpression))
Query Or((QueryCondition condition))

Adds the condition (predicate) to the current query condition using the OR logical operation.

Parameters:

  • sourceColumnAlias – an alias of the column, for which the predicate is added;
  • sourceAlias – the alias of the source;
  • subSelect – the data selection subquery used as a predicate;
  • subSelectQuery – the subquery used as a predicate;
  • parameter – parameter that the predicate is added to;
  • columnExpression – the expression used as a predicate;
  • condition – the query condition.

Update Set((string sourceColumnAlias, Select subSelect))
Update Set((string sourceColumnAlias, Query subSelectQuery))
Update Set((string sourceColumnAlias, QueryColumnExpression columnExpression))
Update Set((string sourceColumnAlias, QueryParameter parameter))

Adds a SET clause to the current query for assigning the passed expression or parameter to the column. Returns the current Update instance.

Parameters:

  • sourceColumnAlias – column alias;
  • subSelect – selection subquery;
  • subSelectQuery – subquery;
  • columnExpression – expression of the column;
  • parameter – parameter of the query.

See also

© Creatio 2002-2020.

Did you find this information useful?

How can we improve it?