SQLUpserter Class |
Namespace: NetQuarry
The SQLUpserter type exposes the following members.
Name | Description | |
---|---|---|
SQLUpserter |
Constructor.
|
Name | Description | |
---|---|---|
ColumnCount |
The number of columns that have been added to be inserted, updated, and/or matched.
| |
Hints |
Gets/sets the SQL hints applied to the MERGE statement. If no Hints are explicitly specified then ROWLOCK is used.
However, the ROWLOCK hint can be suppressed using NoRowLock when generating/executing.
| |
Schema |
Retrieves the schema for the specified Table. Requires that the object was constructed
with the SQLUpserter(IDatabase, String) constructor.
| |
Table |
Gets/Sets the table that this class should using when building the MERGE statement.
This is normally set in the constructor.
|
Name | Description | |
---|---|---|
AddColumn(String, Object, OleDbType, UpsertRoles) |
Adds a column to the class
| |
AddColumn(String, Object, OleDbType, UpsertRoles, Int32) |
Adds a column to the class, truncating if necessary.
| |
AddColumn(String, Object, OleDbType, UpsertRoles, Int32, SQLColumnFlags) |
Adds a column to the class, truncating if necessary.
| |
AddColumnPerSchema |
Adds a column to the class if the column is found in the table's schema. The Schema is
interrogated from the IDatabase object and for the Table provided in the
object's SQLInserter(IDatabase, String) constructor which must have been used in order to
use this method.
| |
AddExpression |
Adds a SQL expression string to the clause inserting or updating the specified column.
| |
AddFilter |
Add a filter clause. Typically a filter is added to the Match clause (and this is assumed if no role
is specified), but filters CAN be added to the other clauses.
| |
Equals | (Inherited from Object.) | |
Execute(String, SQLHelperFlags) |
Execute the SQL MERGE statement. Note that embedded functions are always resolved.
| |
Execute(String, SQLHelperFlags, Int32) |
Execute the SQL MERGE statement. Note that embedded functions are always resolved.
| |
Finalize | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | (Inherited from Object.) | |
ToString(DBMSType, SQLHelperFlags) |
Returns the MERGE statement.
|
Name | Description | |
---|---|---|
EqualValue |
Determines if the object value is equal to another object. If the two objects are null, then this returns true.
There is special handling for guid comparisons (since a guid could be a string formatted in up to 3 different ways).
If the special guid handling is not performed, then the object.Equals method is used.
(Defined by EAPUtil.) |
The basic order of events when using a SQLUpserter is as follows:
upserter.AddColumn("owner_id", this.AppContext.UserContext.ID, System.Data.OleDb.OleDbType.VarWChar, UpsertRoles.Insert | UpsertRoles.Match, 100); upserter.AddColumn("updated_dt", DateTime.UtcNow, System.Data.OleDb.OleDbType.DBTimeStamp, UpsertRoles.Insert | UpsertRoles.Update);
upserter.AddColumn("visits", 1, System.Data.OleDb.OleDbType.Integer, UpsertRoles.Insert); upserter.AddExpression("visits", "visits + 1", UpsertRoles.Update);