Class BaseSqlWriter
- Namespace
- Dynamicweb.DataIntegration.Integration
- Assembly
- Dynamicweb.DataIntegration.dll
public abstract class BaseSqlWriter : BaseDestinationWriter, IDestinationWriter
- Inheritance
-
BaseSqlWriter
- Implements
- 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
mapping
MappingEcomProducts mapping
sqlCommand
SqlCommandCommand instance to execute the sql update statement
shop
stringShop ID
languageId
stringhideDeactivatedProducts
bool
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
mapping
MappingMapping
extraConditions
stringWhere condition to filter data for deletion
sqlCommand
SqlCommandCommand instance to execute the sql delete statement
tempTablePrefix
stringTemporary table prefix
removeMissingAfterImportDestinationTablesOnly
boolRemove 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
sqlCommand
SqlCommandCommand instance to execute the sql delete statement
mapping
MappingMapping
extraConditions
stringWhere condition to filter data for deletion
tempTablePrefix
stringTemporary table prefix
removeMissingAfterImportDestinationTablesOnly
boolRemove 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
sqlCommand
SqlCommandCommand instance to execute the sql delete statement
mappings
Dictionary<string, Mapping>Dictionary of Temporary table prefixes and their mapping
extraConditions
stringWhere 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
mapping
MappingMapping
extraConditions
stringWhere condition to filter data for deletion
sqlCommand
SqlCommandCommand instance to execute the sql delete statement
tempTablePrefix
stringTemporary 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
sqlCommand
SqlCommandCommand instance to execute the sql delete statement
mapping
MappingMapping
extraConditions
stringWhere condition to filter data for deletion
tempTablePrefix
stringTemporary 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
deleteExistingRows
boolIf true deletes existing rows present in the import source. If false deletes excess rows not present in the import source.
mapping
MappingMapping
extraConditions
stringWhere condition to filter data for deletion
sqlCommand
SqlCommandCommand instance to execute the sql delete statement
tempTablePrefix
stringTemporary 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
deleteExistingRows
boolIf true deletes existing rows present in the import source. If false deletes excess rows not present in the import source.
mappings
Dictionary<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
extraConditions
stringWhere condition to filter data for deletion
sqlCommand
SqlCommandCommand 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
ex
ExceptionsqlCommand
SqlCommandmapping
MappingtempTablePrefix
stringinsertColumns
List<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
ex
ExceptionsqlCommand
SqlCommandmapping
MappingtempTablePrefix
stringinsertColumns
List<string>sourceTableName
stringdestinationTableName
string
Returns
HasIdentity(ColumnMappingCollection)
protected static bool HasIdentity(ColumnMappingCollection mappings)
Parameters
mappings
ColumnMappingCollection
Returns
HasIdentity(Mapping)
protected static bool HasIdentity(Mapping mapping)
Parameters
mapping
Mapping
Returns
MoveDataToMainTable(Mapping, SqlCommand, SqlTransaction, string)
Move data to main table
protected static void MoveDataToMainTable(Mapping mapping, SqlCommand sqlCommand, SqlTransaction sqlTransaction, string tempTablePrefix)
Parameters
mapping
MappingsqlCommand
SqlCommandsqlTransaction
SqlTransactionTransaction
tempTablePrefix
string
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
mapping
MappingsqlCommand
SqlCommandsqlTransaction
SqlTransactionTransaction
tempTablePrefix
stringupdateOnly
boolUpdate 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
mapping
MappingsqlCommand
SqlCommandsqlTransaction
SqlTransactionTransaction
tempTablePrefix
stringupdateOnly
boolUpdate only
insertOnly
boolInsert 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
sqlCommand
SqlCommandmapping
MappingsqlTransaction
SqlTransactionTransaction
tempTablePrefix
string
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
sqlCommand
SqlCommandmapping
MappingsqlTransaction
SqlTransactionTransaction
tempTablePrefix
stringupdateOnly
boolUpdate only
Returns
SqlBulkCopierWriteToServer(SqlBulkCopy, DataTable, bool, Mapping, ILogger)
protected static int SqlBulkCopierWriteToServer(SqlBulkCopy sqlBulkCopy, DataTable tableToWrite, bool skipFailingRows, Mapping currentMapping, ILogger logger)
Parameters
sqlBulkCopy
SqlBulkCopytableToWrite
DataTableskipFailingRows
boolcurrentMapping
Mappinglogger
ILogger