Table of Contents

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

int

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 Mapping

EcomProducts mapping

sqlCommand SqlCommand

Command instance to execute the sql update statement

shop string

Shop ID

languageId string
hideDeactivatedProducts bool

Returns

int

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 Mapping

Mapping

extraConditions string

Where condition to filter data for deletion

sqlCommand SqlCommand

Command instance to execute the sql delete statement

tempTablePrefix string

Temporary table prefix

removeMissingAfterImportDestinationTablesOnly bool

Remove 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 SqlCommand

Command instance to execute the sql delete statement

mapping Mapping

Mapping

extraConditions string

Where condition to filter data for deletion

tempTablePrefix string

Temporary table prefix

removeMissingAfterImportDestinationTablesOnly bool

Remove missing rows after import in the destination tables only

Returns

long

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 SqlCommand

Command instance to execute the sql delete statement

mappings Dictionary<string, Mapping>

Dictionary of Temporary table prefixes and their mapping

extraConditions string

Where condition to filter data for deletion

Returns

long

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 Mapping

Mapping

extraConditions string

Where condition to filter data for deletion

sqlCommand SqlCommand

Command instance to execute the sql delete statement

tempTablePrefix string

Temporary 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 SqlCommand

Command instance to execute the sql delete statement

mapping Mapping

Mapping

extraConditions string

Where condition to filter data for deletion

tempTablePrefix string

Temporary table prefix

Returns

int

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 bool

If true deletes existing rows present in the import source. If false deletes excess rows not present in the import source.

mapping Mapping

Mapping

extraConditions string

Where condition to filter data for deletion

sqlCommand SqlCommand

Command instance to execute the sql delete statement

tempTablePrefix string

Temporary table prefix

Returns

int

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 bool

If 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 string

Where condition to filter data for deletion

sqlCommand SqlCommand

Command instance to execute the sql delete statement

Returns

int

Number of effected rows in database

Exceptions

InvalidOperationException

GetExtraConditions(Mapping, string, string)

protected static string GetExtraConditions(Mapping mapping, string shop, string languageId)

Parameters

mapping Mapping
shop string
languageId string

Returns

string

GetMoveDataToMainTableException(Exception, SqlCommand, Mapping, string, List<string>)

protected static Exception GetMoveDataToMainTableException(Exception ex, SqlCommand sqlCommand, Mapping mapping, string tempTablePrefix, List<string> insertColumns)

Parameters

ex Exception
sqlCommand SqlCommand
mapping Mapping
tempTablePrefix string
insertColumns List<string>

Returns

Exception

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 Exception
sqlCommand SqlCommand
mapping Mapping
tempTablePrefix string
insertColumns List<string>
sourceTableName string
destinationTableName string

Returns

Exception

HasIdentity(ColumnMappingCollection)

protected static bool HasIdentity(ColumnMappingCollection mappings)

Parameters

mappings ColumnMappingCollection

Returns

bool

HasIdentity(Mapping)

protected static bool HasIdentity(Mapping mapping)

Parameters

mapping Mapping

Returns

bool

MoveDataToMainTable(Mapping, SqlCommand, SqlTransaction, string)

Move data to main table

protected static void MoveDataToMainTable(Mapping mapping, SqlCommand sqlCommand, SqlTransaction sqlTransaction, string tempTablePrefix)

Parameters

mapping Mapping
sqlCommand SqlCommand
sqlTransaction SqlTransaction

Transaction

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 Mapping
sqlCommand SqlCommand
sqlTransaction SqlTransaction

Transaction

tempTablePrefix string
updateOnly bool

Update 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 Mapping
sqlCommand SqlCommand
sqlTransaction SqlTransaction

Transaction

tempTablePrefix string
updateOnly bool

Update only

insertOnly bool

Insert only

Returns

int

MoveDataToMainTable(SqlCommand, Mapping, SqlTransaction, string)

Move data to main table

protected static int MoveDataToMainTable(SqlCommand sqlCommand, Mapping mapping, SqlTransaction sqlTransaction, string tempTablePrefix)

Parameters

sqlCommand SqlCommand
mapping Mapping
sqlTransaction SqlTransaction

Transaction

tempTablePrefix string

Returns

int

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 SqlCommand
mapping Mapping
sqlTransaction SqlTransaction

Transaction

tempTablePrefix string
updateOnly bool

Update only

Returns

int

SqlBulkCopierWriteToServer(SqlBulkCopy, DataTable, bool, Mapping, ILogger)

protected static int SqlBulkCopierWriteToServer(SqlBulkCopy sqlBulkCopy, DataTable tableToWrite, bool skipFailingRows, Mapping currentMapping, ILogger logger)

Parameters

sqlBulkCopy SqlBulkCopy
tableToWrite DataTable
skipFailingRows bool
currentMapping Mapping
logger ILogger

Returns

int
To top