internal static string GetDataTypeDescription(BulkCopyDataType dataType) { var nullable = (((int)dataType & Constants.NullableDataType) == Constants.NullableDataType); dataType = (BulkCopyDataType)((int)dataType & ~Constants.NullableDataType); string dataTypeName; switch (dataType) { case BulkCopyDataType.VarBinaryMax: { dataTypeName = "VarBinary(MAX)"; break; } case BulkCopyDataType.NVarCharMax: { dataTypeName = "NVarChar(MAX)"; break; } case BulkCopyDataType.VarCharMax: { dataTypeName = "VarChar(MAX)"; break; } default: { dataTypeName = dataType.ToString("G"); break; } } return dataTypeName + (nullable ? " NULL" : " NOT NULL"); }
internal UnboundColumn(short index, BulkCopyDataType dataType) { if (index < 0) { throw new ArgumentOutOfRangeException("index", index, "The argument must be >= 0."); } _index = index; _dataType = dataType; }
protected MaxDataType(short index, BulkCopyDataType dataType, BindingFlags options) { if (index < 0) { throw new ArgumentOutOfRangeException("index", index, "The argument must be >= 0."); } _dataType = dataType; _index = index; _options = options; }
protected StandardDataType(short index, BulkCopyDataType dataType, int length, BindingFlags options = BindingFlags.None) { if (index < 0) { throw new ArgumentOutOfRangeException("index", index, "The argument must be >= 0."); } int byteLength; if ((options & BindingFlags.DoubleByteCharacterSet) == 0) { if (length < 1 || length > Constants.SqlMaximumByteLength) { throw new ArgumentOutOfRangeException("length", length, "The argument must be between 1 and 8000."); } byteLength = length; } else { if (length < 1 || length > Constants.SqlMaximumDoubleByteCharacterSetByteLength) { throw new ArgumentOutOfRangeException("length", length, "The argument must be between 1 and 4000."); } byteLength = length * 2; } if (dataType >= BulkCopyDataType.NullableBit) { options |= BindingFlags.Nullable; } if ((options & (BindingFlags.Nullable | BindingFlags.VariableLengthIn | BindingFlags.VariableLengthOut)) != 0) { _indicatorLength = IndicatorLengthInBytes; } _byteLength = byteLength; _data = new byte[_indicatorLength + byteLength]; _dataType = dataType; _handle = GCHandle.Alloc(_data, GCHandleType.Pinned); _index = index; _options = options; _pointer = (byte*)_handle.AddrOfPinnedObject(); }
public StandardDataTypeImpl(short index, BulkCopyDataType dataType, int length, BindingFlags options) : base(index, dataType, length, options) { // }
public MaxDataTypeImpl(short index, BulkCopyDataType dataType, BindingFlags options) : base(index, dataType, options) { // }