You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@ -0,0 +1,119 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="SqlBulkCopyColumnMapping.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
// <owner current="true" primary="true">[....]</owner>
|
||||
// <owner current="true" primary="false">[....]</owner>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Todo: rename the file
|
||||
// Caution! ndp\fx\src\data\netmodule\sources needs to follow this change
|
||||
|
||||
namespace System.Data.SqlClient
|
||||
{
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Data.SqlTypes;
|
||||
using System.ComponentModel;
|
||||
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
// this class helps allows the user to create association between source- and targetcolumns
|
||||
//
|
||||
//
|
||||
|
||||
public sealed class SqlBulkCopyColumnMapping {
|
||||
internal string _destinationColumnName;
|
||||
internal int _destinationColumnOrdinal;
|
||||
internal string _sourceColumnName;
|
||||
internal int _sourceColumnOrdinal;
|
||||
|
||||
// devnote: we don't want the user to detect the columnordinal after WriteToServer call.
|
||||
// _sourceColumnOrdinal(s) will be copied to _internalSourceColumnOrdinal when WriteToServer executes.
|
||||
internal int _internalDestinationColumnOrdinal;
|
||||
internal int _internalSourceColumnOrdinal; // -1 indicates an undetermined value
|
||||
|
||||
public string DestinationColumn {
|
||||
get {
|
||||
if (_destinationColumnName != null) {
|
||||
return _destinationColumnName;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
set {
|
||||
_destinationColumnOrdinal = _internalDestinationColumnOrdinal = -1;
|
||||
_destinationColumnName = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int DestinationOrdinal {
|
||||
get {
|
||||
return _destinationColumnOrdinal;
|
||||
}
|
||||
set {
|
||||
if (value >= 0) {
|
||||
_destinationColumnName = null;
|
||||
_destinationColumnOrdinal = _internalDestinationColumnOrdinal = value;
|
||||
}
|
||||
else {
|
||||
throw ADP.IndexOutOfRange(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string SourceColumn {
|
||||
get {
|
||||
if (_sourceColumnName != null) {
|
||||
return _sourceColumnName;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
set {
|
||||
_sourceColumnOrdinal = _internalSourceColumnOrdinal = -1;
|
||||
_sourceColumnName = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int SourceOrdinal {
|
||||
get {
|
||||
return _sourceColumnOrdinal;
|
||||
}
|
||||
set {
|
||||
if (value >= 0) {
|
||||
_sourceColumnName = null;
|
||||
_sourceColumnOrdinal = _internalSourceColumnOrdinal = value;
|
||||
}
|
||||
else {
|
||||
throw ADP.IndexOutOfRange(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SqlBulkCopyColumnMapping () {
|
||||
_internalSourceColumnOrdinal = -1;
|
||||
}
|
||||
|
||||
public SqlBulkCopyColumnMapping (string sourceColumn, string destinationColumn) {
|
||||
SourceColumn = sourceColumn;
|
||||
DestinationColumn = destinationColumn;
|
||||
}
|
||||
|
||||
public SqlBulkCopyColumnMapping (int sourceColumnOrdinal, string destinationColumn) {
|
||||
SourceOrdinal = sourceColumnOrdinal;
|
||||
DestinationColumn = destinationColumn;
|
||||
}
|
||||
|
||||
public SqlBulkCopyColumnMapping (string sourceColumn, int destinationOrdinal) {
|
||||
SourceColumn = sourceColumn;
|
||||
DestinationOrdinal = destinationOrdinal;
|
||||
}
|
||||
|
||||
public SqlBulkCopyColumnMapping (int sourceColumnOrdinal, int destinationOrdinal) {
|
||||
SourceOrdinal = sourceColumnOrdinal;
|
||||
DestinationOrdinal = destinationOrdinal;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user