Skip to main content
Version: 8.1

Update class

Level: advanced

Terrasoft.Core.DB namespace.

The Terrasoft.Core.DB.Update class builds queries to modify records in Creatio database tables. As a result of creating and configuring an instance of this class, Creatio will build an UPDATE SQL query.

note

View the entire list of methods and properties of the Update class, its parent classes, as well as the interfaces it implements, in the .NET class library documentation.

Constructors

Update(UserConnection userConnection)

Creates a class instance using UserConnection.

Update(UserConnection userConnection, string schemaName)

Creates a class instance for the specified schema using UserConnection.

Update(UserConnection userConnection, ModifyQuerySource source)

Creates a class instance for the specified data source using UserConnection.

Update(Insert source)

Creates a class instance that is a clone of the instance passed as the argument.

Properties

UserConnection Terrasoft.Core.UserConnection

The user connection that the query uses.

Condition Terrasoft.Core.DB.QueryCondition

The Where condition of the query.

HasCondition bool

Whether the query has a Where expression.

Source Terrasoft.Core.DB.ModifyQuerySource

The query data source.

ColumnValues Terrasoft.Core.DB.ModifyQueryColumnValueCollection

The collection of query column values.

Methods

void ResetCachedSqlText()

Clears the cached query text.

QueryParameterCollection GetUsingParameters()

Returns the parameter collection that the query uses.

int Execute()

Executes the query. Returns the number of records that the query involved.

int Execute(DBExecutor dbExecutor)

Executes the query using the DBExecutor instance. Returns the number of records that the query processed.

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

The alias of the schema to which to add the condition.

sourceAlias

The alias of the source.

subSelect

The data selection subquery to whose results to add the condition.

subSelectQuery

The subquery to whose results to add the condition.

columnExpression

The expression to whose results to add the condition.

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

The name of the schema to which to add the predicate.

sourceAlias

The alias of the source.

subSelect

The data selection subquery that serves as a predicate.

subSelectQuery

The subquery that serves as a predicate

parameter

The parameter to which to add the predicate.

columnExpression

The expression that serves 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

The name of the schema to which to add the predicate.

sourceAlias

The alias of the source.

subSelect

The data select subquery that serves as a predicate.

subSelectQuery

The subquery that serves as a predicate

parameter

The parameter to which to add the predicate.

columnExpression

The expression that serves 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. Required to assign the passed expression or parameter to the column. Returns the current Update instance.

Parameters

sourceColumnAlias

The column alias.

subSelect

The select subquery.

subSelectQuery

The subquery.

columnExpression

The column expression.

parameter

The query parameter.