// Token: 0x06000AAA RID: 2730 RVA: 0x0002FE2F File Offset: 0x0002E02F protected virtual Exception GetOperationCanceledException(string operationName, OperationAbortedException abortedEx) { return(abortedEx); }
// Token: 0x060020F4 RID: 8436 RVA: 0x00097D3D File Offset: 0x00095F3D protected override Exception GetOperationCanceledException(string operationName, OperationAbortedException abortedEx) { return(MapiExceptionHelper.CancelException(ReplayStrings.ReplayStoreOperationAbortedException(operationName), abortedEx)); }
private void WriteToServerInternal() { string tDSCommand = null; bool flag3 = false; bool flag2 = false; int[] useSqlValue = null; int num5 = this._batchSize; bool flag4 = false; if (this._batchSize > 0) { flag4 = true; } Exception inner = null; this._rowsCopied = 0; if (this._destinationTableName == null) { throw SQL.BulkLoadMissingDestinationTable(); } if (this.ReadFromRowSource()) { RuntimeHelpers.PrepareConstrainedRegions(); try { bool flag = true; this._parser = this._connection.Parser; this._stateObj = this._parser.GetSession(this); this._stateObj._bulkCopyOpperationInProgress = true; try { BulkCopySimpleResultSet set; this._stateObj.StartSession(this.ObjectID); try { set = this.CreateAndExecuteInitialQuery(); } catch (SqlException exception5) { throw SQL.BulkLoadInvalidDestinationTable(this._destinationTableName, exception5); } this._rowsUntilNotification = this._notifyAfter; tDSCommand = this.AnalyzeTargetAndCreateUpdateBulkCommand(set); if (this._sortedColumnMappings.Count == 0) { return; } this._stateObj.SniContext = SniContext.Snix_SendRows; Label_00DD: if (this.IsCopyOption(SqlBulkCopyOptions.UseInternalTransaction)) { this._internalTransaction = this._connection.BeginTransaction(); } this.SubmitUpdateBulkCommand(set, tDSCommand); try { this.WriteMetaData(set); object[] objArray = new object[this._sortedColumnMappings.Count]; if (useSqlValue == null) { useSqlValue = new int[objArray.Length]; } int num3 = num5; do { for (int i = 0; i < objArray.Length; i++) { _ColumnMapping mapping = (_ColumnMapping)this._sortedColumnMappings[i]; _SqlMetaData metadata = mapping._metadata; object obj2 = this.GetValueFromSourceRow(mapping._sourceColumnOrdinal, metadata, useSqlValue, i); objArray[i] = this.ConvertValue(obj2, metadata); } this._parser.WriteByte(0xd1, this._stateObj); for (int j = 0; j < objArray.Length; j++) { _ColumnMapping mapping2 = (_ColumnMapping)this._sortedColumnMappings[j]; _SqlMetaData data = mapping2._metadata; if (data.type != SqlDbType.Variant) { this._parser.WriteBulkCopyValue(objArray[j], data, this._stateObj); } else { this._parser.WriteSqlVariantDataRowValue(objArray[j], this._stateObj); } } this._rowsCopied++; if (((this._notifyAfter > 0) && (this._rowsUntilNotification > 0)) && (--this._rowsUntilNotification == 0)) { try { this._stateObj.BcpLock = true; flag2 = this.FireRowsCopiedEvent((long)this._rowsCopied); Bid.Trace("<sc.SqlBulkCopy.WriteToServerInternal|INFO> \n"); if (ConnectionState.Open != this._connection.State) { goto Label_02F7; } } catch (Exception exception2) { if (!ADP.IsCatchableExceptionType(exception2)) { throw; } inner = OperationAbortedException.Aborted(exception2); goto Label_02F7; } finally { this._stateObj.BcpLock = false; } if (flag2) { goto Label_02F7; } this._rowsUntilNotification = this._notifyAfter; } if (this._rowsUntilNotification > this._notifyAfter) { this._rowsUntilNotification = this._notifyAfter; } flag3 = this.ReadFromRowSource(); if (flag4) { num3--; if (num3 == 0) { goto Label_02F7; } } }while (flag3); } catch (NullReferenceException) { this._stateObj.CancelRequest(); throw; } catch (Exception exception4) { if (ADP.IsCatchableExceptionType(exception4)) { this._stateObj.CancelRequest(); } throw; } Label_02F7: if (ConnectionState.Open != this._connection.State) { throw ADP.OpenConnectionRequired("WriteToServer", this._connection.State); } this._parser.WriteBulkCopyDone(this._stateObj); this._parser.Run(RunBehavior.UntilDone, null, null, null, this._stateObj); if (flag2 || (inner != null)) { throw OperationAbortedException.Aborted(inner); } if (this._internalTransaction != null) { this._internalTransaction.Commit(); this._internalTransaction = null; } if (flag3) { goto Label_00DD; } this._localColumnMappings = null; } catch (Exception exception3) { flag = ADP.IsCatchableExceptionType(exception3); if (flag) { this._stateObj._internalTimeout = false; if (this._internalTransaction != null) { if (!this._internalTransaction.IsZombied) { this._internalTransaction.Rollback(); } this._internalTransaction = null; } } throw; } finally { if (flag && (this._stateObj != null)) { this._stateObj.CloseSession(); } } } finally { if (this._stateObj != null) { this._stateObj._bulkCopyOpperationInProgress = false; this._stateObj = null; } } } }