Class BaseSqlWriter
- Namespace
- Dynamicweb.DataIntegration.Integration
- Assembly
- Dynamicweb.DataIntegration.dll
public abstract class BaseSqlWriter : BaseDestinationWriter, IDestinationWriter
- Inheritance
-
BaseSqlWriter
- Implements
- Derived
- Inherited Members
Properties
RowsAffected
public virtual int RowsAffected { get; set; }
Property Value
Methods
DeactivateMissingProductsInMainTable(Mapping, SqlCommand, string, string, bool)
Deactivates existing products which are missing in the import source
protected static int DeactivateMissingProductsInMainTable(Mapping mapping, SqlCommand sqlCommand, string shop, string languageId, bool hideDeactivatedProducts)
Parameters
mappingMappingEcomProducts mapping
sqlCommandSqlCommandCommand instance to execute the sql update statement
shopstringShop ID
languageIdstringhideDeactivatedProductsbool
Returns
DeleteExcessFromMainTable(Mapping, string, SqlCommand, string, bool)
Deletes rows not present in the import source
protected static void DeleteExcessFromMainTable(Mapping mapping, string extraConditions, SqlCommand sqlCommand, string tempTablePrefix, bool removeMissingAfterImportDestinationTablesOnly)
Parameters
mappingMappingMapping
extraConditionsstringWhere condition to filter data for deletion
sqlCommandSqlCommandCommand instance to execute the sql delete statement
tempTablePrefixstringTemporary table prefix
removeMissingAfterImportDestinationTablesOnlyboolRemove missing rows after import in the destination tables only
DeleteExcessFromMainTable(SqlCommand, Mapping, string, string, bool)
Deletes rows not present in the import source
protected static long DeleteExcessFromMainTable(SqlCommand sqlCommand, Mapping mapping, string extraConditions, string tempTablePrefix, bool removeMissingAfterImportDestinationTablesOnly)
Parameters
sqlCommandSqlCommandCommand instance to execute the sql delete statement
mappingMappingMapping
extraConditionsstringWhere condition to filter data for deletion
tempTablePrefixstringTemporary table prefix
removeMissingAfterImportDestinationTablesOnlyboolRemove missing rows after import in the destination tables only
Returns
DeleteExcessFromMainTable(SqlCommand, Dictionary<string, Mapping>, string)
Deletes rows not present in the import sources
protected static long DeleteExcessFromMainTable(SqlCommand sqlCommand, Dictionary<string, Mapping> mappings, string extraConditions)
Parameters
sqlCommandSqlCommandCommand instance to execute the sql delete statement
mappingsDictionary<string, Mapping>Dictionary of Temporary table prefixes and their mapping
extraConditionsstringWhere condition to filter data for deletion
Returns
DeleteExistingFromMainTable(Mapping, string, SqlCommand, string)
Deletes existing rows present in the import source
protected static void DeleteExistingFromMainTable(Mapping mapping, string extraConditions, SqlCommand sqlCommand, string tempTablePrefix)
Parameters
mappingMappingMapping
extraConditionsstringWhere condition to filter data for deletion
sqlCommandSqlCommandCommand instance to execute the sql delete statement
tempTablePrefixstringTemporary table prefix
DeleteExistingFromMainTable(SqlCommand, Mapping, string, string)
Deletes existing rows present in the import source
protected static int DeleteExistingFromMainTable(SqlCommand sqlCommand, Mapping mapping, string extraConditions, string tempTablePrefix)
Parameters
sqlCommandSqlCommandCommand instance to execute the sql delete statement
mappingMappingMapping
extraConditionsstringWhere condition to filter data for deletion
tempTablePrefixstringTemporary table prefix
Returns
DeleteRowsFromMainTable(bool, Mapping, string, SqlCommand, string)
Deletes rows present/not present in the import source
protected static int DeleteRowsFromMainTable(bool deleteExistingRows, Mapping mapping, string extraConditions, SqlCommand sqlCommand, string tempTablePrefix)
Parameters
deleteExistingRowsboolIf true deletes existing rows present in the import source. If false deletes excess rows not present in the import source.
mappingMappingMapping
extraConditionsstringWhere condition to filter data for deletion
sqlCommandSqlCommandCommand instance to execute the sql delete statement
tempTablePrefixstringTemporary table prefix
Returns
DeleteRowsFromMainTable(bool, Dictionary<string, Mapping>, string, SqlCommand)
Deletes rows present/not present in the import source
protected static int DeleteRowsFromMainTable(bool deleteExistingRows, Dictionary<string, Mapping> mappings, string extraConditions, SqlCommand sqlCommand)
Parameters
deleteExistingRowsboolIf true deletes existing rows present in the import source. If false deletes excess rows not present in the import source.
mappingsDictionary<string, Mapping>Dictionary of Temporary table prefixes and their mapping, for extending the exists/not-exists for deletion when having multiple TempTables for the same MainTable
extraConditionsstringWhere condition to filter data for deletion
sqlCommandSqlCommandCommand instance to execute the sql delete statement
Returns
- int
Number of effected rows in database
Exceptions
GetExtraConditions(Mapping, string, string)
protected static string GetExtraConditions(Mapping mapping, string shop, string languageId)
Parameters
Returns
GetMoveDataToMainTableException(Exception, SqlCommand, Mapping, string, List<string>)
protected static Exception GetMoveDataToMainTableException(Exception ex, SqlCommand sqlCommand, Mapping mapping, string tempTablePrefix, List<string> insertColumns)
Parameters
exExceptionsqlCommandSqlCommandmappingMappingtempTablePrefixstringinsertColumnsList<string>
Returns
GetMoveDataToMainTableException(Exception, SqlCommand, Mapping, string, List<string>, string?, string?)
protected static Exception GetMoveDataToMainTableException(Exception ex, SqlCommand sqlCommand, Mapping mapping, string tempTablePrefix, List<string> insertColumns, string? sourceTableName, string? destinationTableName)
Parameters
exExceptionsqlCommandSqlCommandmappingMappingtempTablePrefixstringinsertColumnsList<string>sourceTableNamestringdestinationTableNamestring
Returns
HasIdentity(ColumnMappingCollection)
protected static bool HasIdentity(ColumnMappingCollection mappings)
Parameters
mappingsColumnMappingCollection
Returns
HasIdentity(Mapping)
protected static bool HasIdentity(Mapping mapping)
Parameters
mappingMapping
Returns
MoveDataToMainTable(Mapping, SqlCommand, SqlTransaction, string)
Move data to main table
protected static void MoveDataToMainTable(Mapping mapping, SqlCommand sqlCommand, SqlTransaction sqlTransaction, string tempTablePrefix)
Parameters
mappingMappingsqlCommandSqlCommandsqlTransactionSqlTransactionTransaction
tempTablePrefixstring
MoveDataToMainTable(Mapping, SqlCommand, SqlTransaction, string, bool)
Move data to main table
protected static void MoveDataToMainTable(Mapping mapping, SqlCommand sqlCommand, SqlTransaction sqlTransaction, string tempTablePrefix, bool updateOnly)
Parameters
mappingMappingsqlCommandSqlCommandsqlTransactionSqlTransactionTransaction
tempTablePrefixstringupdateOnlyboolUpdate only
MoveDataToMainTable(Mapping, SqlCommand, SqlTransaction, string, bool, bool)
Move data to main table
protected static int MoveDataToMainTable(Mapping mapping, SqlCommand sqlCommand, SqlTransaction sqlTransaction, string tempTablePrefix, bool updateOnly, bool insertOnly)
Parameters
mappingMappingsqlCommandSqlCommandsqlTransactionSqlTransactionTransaction
tempTablePrefixstringupdateOnlyboolUpdate only
insertOnlyboolInsert only
Returns
MoveDataToMainTable(SqlCommand, Mapping, SqlTransaction, string)
Move data to main table
protected static int MoveDataToMainTable(SqlCommand sqlCommand, Mapping mapping, SqlTransaction sqlTransaction, string tempTablePrefix)
Parameters
sqlCommandSqlCommandmappingMappingsqlTransactionSqlTransactionTransaction
tempTablePrefixstring
Returns
MoveDataToMainTable(SqlCommand, Mapping, SqlTransaction, string, bool)
Move data to main table
protected static int MoveDataToMainTable(SqlCommand sqlCommand, Mapping mapping, SqlTransaction sqlTransaction, string tempTablePrefix, bool updateOnly)
Parameters
sqlCommandSqlCommandmappingMappingsqlTransactionSqlTransactionTransaction
tempTablePrefixstringupdateOnlyboolUpdate only
Returns
SqlBulkCopierWriteToServer(SqlBulkCopy, DataTable, bool, Mapping, ILogger?)
protected static int SqlBulkCopierWriteToServer(SqlBulkCopy sqlBulkCopy, DataTable tableToWrite, bool skipFailingRows, Mapping currentMapping, ILogger? logger)
Parameters
sqlBulkCopySqlBulkCopytableToWriteDataTableskipFailingRowsboolcurrentMappingMappingloggerILogger