InsertSelect class
Terrasoft.Core.DB
namespace.
The Terrasoft.Core.DB.InsertSelect
class builds queries to add records to Creatio database tables. The Terrasoft.Core.DB.Select
class instance serves as a data source. As a result of creating and configuring an instance of Terrasoft.Core.DB.InsertSelect
, Creatio will build an INSERT INTO SELECT
SQL query.
When working with the InsertSelect
class, Creatio does not apply the default access permissions to the added records. Moreover, Creatio does not apply any permissions to such records, including object operation permissions, record permissions, column permissions. The class uses the user connection only to access the database table.
As a result of an InsertSelect
query, Creatio will add all records returned in the Select
subquery to the database.
Constructors
InsertSelect(UserConnection userConnection)
Creates a class instance with the specified UserConnection
.
InsertSelect(InsertSelect 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.
Columns Terrasoft.Core.DB.ModifyQueryColumnValueCollection
The collection of query column values.
Select Terrasoft.Core.DB.Select
The Terrasoft.Core.DB.Select
instance that the query uses.
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 involved.
InsertSelect Into(string schemaName)
InsertSelect Into(ModifyQuerySource source)
Adds the data source to the current query.
Parameters
schemaName | The schema name. |
source | The data source. |
InsertSelect Set(IEnumerable<string> sourceColumnAliases)
InsertSelect Set(params string[] sourceColumnAliases)
InsertSelect Set(IEnumerable<ModifyQueryColumn> columns)
InsertSelect Set(params ModifyQueryColumn[] columns)
Adds a set of columns to the current query. The subquery assigns values to the columns. Returns the current InsertSelect
instance.
Parameters
sourceColumnAliases | A method parameter collection or array, which contains the column aliases. |
Columns | A method parameter collection or array, which contains the column instances. |
InsertSelect FromSelect(Select subSelect)
InsertSelect FromSelect(Query subSelectQuery)
Adds the SELECT
clause to the current query.
Parameters
subSelect | The select subquery. |
subSelectQuery | The subquery. |