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

The Insert class

Glossary Item Box

Introduction

The Terrasoft.Core.DB.Insert class is used to build queries for adding records in Creatio database tables. As a result of creating and configuring the instance of this class, the INSERT SQL-expression query to the application database will be built. Execution of the query results in returning the number of involved records.

When working with the Insert class, the access permissions are not applied to the added records. The user connection is only used for accessing the database table.

The “Terrasoft.Core.DB.Insert“ class

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

Constructors

public Entity((UserConnection userConnection))
Creates a new Entity class instance for the set UserConnection.
public Insert((UserConnection userConnection))
Creates a class instance with the specified UserConnection parameter.
public Insert((Insert source))
Creates a class instance that is a clone of the instance passed as an argument.

Properties

Table 1. Primary properties of the Insert class

UserConnection
Terrasoft.Core.UserConnection
The current user connection at the moment of executing the query.
Source
Terrasoft.Core.DB.ModifyQuerySource
Data source.
Parameters
Terrasoft.Core.DB.QueryParameterCollection
Collection of the query parameters.
HasParameters
bool
Determines whether the query has any parameters.
BuildParametersAsValue
bool
Determines whether the query parameters are to be added as values into the query text.
ColumnValues
Terrasoft.Core.DB.ModifyQueryColumnValueCollection
Collection of values of the query columns.
ColumnValuesCollection
List<ModifyQueryColumnValueCollection>
Collection of column values for adding multiple records (see “Multi-row data insert. The Insert class”).

Methods

Table 2. Primary methods of the Insert 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.
void ResetParameters(())
Clears the collection of the query parameters.
void SetParameterValue((string name, object value))

Sets the value of the query parameter.

Parameters:

  • name – parameter name;
  • value – the value.

void InitializeParameters(())
Initiates the collection of the query parameters.
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.
Insert Into((string schemaName))
Insert Into((ModifyQuerySource source))

Adds the 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 for assigning the passed expression or parameter to the column. Returns the current Insert instance.

Parameters:

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

Insert Values(())
Initiates values for adding multiple columns (see “Multi-row data insert. The “Insert” class”).

See also

© Creatio 2002-2020.

Did you find this information useful?

How can we improve it?