Skip to main content
Version: 8.2

Insert class

Level: advanced

Terrasoft.Core.DB namespace.

The Terrasoft.Core.DB.Insert class builds queries to add records to Creatio database tables. As a result of creating and configuring an instance of this class, Creatio will build an INSERT SQL query. The query returns the number of records involved.

Important

When working with the Insert class, Creatio does not apply the default access permissions to the added records. The class uses the user connection only to access the database table.

note

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

Constructors

Entity(UserConnection userConnection)

Creates a new Entity class instance for the set UserConnection user connection.

Insert(UserConnection userConnection)

Creates a class instance with the specified UserConnection.

Insert(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.

Source Terrasoft.Core.DB.ModifyQuerySource

The data source.

Parameters Terrasoft.Core.DB.QueryParameterCollection

The query parameter collection.

HasParameters bool

Whether the query has parameters.

BuildParametersAsValue bool

Whether to add the query parameters to the query text as values.

ColumnValues Terrasoft.Core.DB.ModifyQueryColumnValueCollection

The collection of query column values.

ColumnValuesCollection List<ModifyQueryColumnValueCollection>

The collection of column values required to add records in bulk.

Methods

void ResetCachedSqlText()

Clears the cached query text.

QueryParameterCollection GetUsingParameters()

Returns the parameter collection that the query uses.

void ResetParameters()

Clears the query parameter collection.

void SetParameterValue(string name, object value)

Sets the value of the query parameter

Parameters

name

The parameter name.

value

The value.

void InitializeParameters()

Initializes the query parameter collection.

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.

Insert Into(string schemaName)
Insert Into(ModifyQuerySource source)

Adds a data source to the current query.

Parameters

schemaName

The schema name.

source

The data source.

Insert Set(string sourceColumnAlias, Select subSelect)
Insert Set(string sourceColumnAlias, Query subSelectQuery)
Insert Set(string sourceColumnAlias, QueryColumnExpression columnExpression)
Insert 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 Insert instance.

Parameters

sourceColumnAlias

The column alias.

subSelect

The select subquery.

subSelectQuery

The subquery.

columnExpression

The column expression.

parameter

The query parameter.

Insert Values()

Initializes the values required to add records in bulk.