SqlInsertBuilder Class
.NET Standard 2.x
Represents an object used to build a SQL INSERT statement.
The SQL INSERT statement can be used to add one or more rows to a table or view in the database.
Namespace: SnapObjects.Data
Assembly: SnapObjects.Data.dll
Implements
SnapObjects.Data.SqlBuilderBase
SnapObjects.Data.ISqlInsertBuilder
Syntax
public class SqlInsertBuilder : SqlBuilderBase, ISqlInsertBuilder;
Constructor
Name | Description |
---|---|
SqlInsertBuilder(string name = "") | Initializes a new instance of the SqlInsertBuilder class. |
Properties
Name | Return Type | Description |
---|---|---|
Name | string | Gets the name of the current object. |
SqlType | SqlStatementType | Gets the SQL statement type of the current object. |
UsedParameters | IReadOnlyDictionary<string, ISqlParameter> | Gets an IReadOnlyDictionary<string, ISqlParameter> object that contains all parameters used in the current object. |
Methods
Name | Return Type | Description |
---|---|---|
AddParameters(params ISqlParameter[] parameters) | bool | Adds the parameters which will be used in the SQL statement to the current object. |
Clone() | ISqlBuilder | Makes a copy of the current ISqlBuilder object. |
Column(string columnName, ISqlParameter parameter) | ISqlInsertBuilder | Inserts dynamic data into the column of a table. The dynamic data will be specified by a SQL parameter when the SQL is executed. |
ColumnValue(string columnName, object value) | ISqlInsertBuilder | Specifies the value to be inserted into the column of a table. |
GetParameterPlacehold(string name) | string | Gets the placeholder string for a SQL parameter. |
Insert(string table) | ISqlInsertBuilder | Inserts a row (by a SQL INSERT statement) and specifies the name of the table or view that will receive the data. |
Insert(string table, string schema) | ISqlInsertBuilder | Inserts a row (by a SQL INSERT statement) and specifies the name and the schema of the table or view that will receive the data. |
Reset() | ISqlBuilder | Clears the SQL statement and all of the SQL parameters defined in the current object. |
ToReadOnly() | ISqlReadOnlyBuilder | Gets a read-only ISqlReadOnlyBuilder object generated by the clone of the current object. |
ToSqlString(DataContext context) | string | Returns the raw SQL string for the corresponding database by the current object. |
Validate(DataContext context, bool throwError = true) | bool | Validates the raw SQL string for the specified database generated by the current SqlBuilder. |