本文整理汇总了C#中Microsoft.SqlServer.Server.SmiTypedGetterSetter类的典型用法代码示例。如果您正苦于以下问题:C# SmiTypedGetterSetter类的具体用法?C# SmiTypedGetterSetter怎么用?C# SmiTypedGetterSetter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SmiTypedGetterSetter类属于Microsoft.SqlServer.Server命名空间,在下文中一共展示了SmiTypedGetterSetter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RowAvailable
internal virtual void RowAvailable(SmiTypedGetterSetter rowData) {
// Adding as of V200
// Implement body with throw because there are only a couple of ways to get to this code:
// 1) Client is calling this method even though the server negotiated for V3- and hasn't implemented V200 yet.
// 2) Server didn't implement V200 on some interface, but negotiated V200+.
System.Data.Common.ADP.InternalError( System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod );
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:8,代码来源:SmiEventSink.cs
示例2: GetTimeSpan_Unchecked
private static TimeSpan GetTimeSpan_Unchecked(SmiEventSink_Default sink, SmiTypedGetterSetter getters, int ordinal)
{
TimeSpan timeSpan = getters.GetTimeSpan(sink, ordinal);
sink.ProcessMessagesAndThrow();
return timeSpan;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:6,代码来源:ValueUtilsSmi.cs
示例3: GetSqlValue200
// dealing with v200 SMI
internal static object GetSqlValue200(
SmiEventSink_Default sink,
SmiTypedGetterSetter getters,
int ordinal,
SmiMetaData metaData,
SmiContext context
) {
object result = null;
if (IsDBNull_Unchecked(sink, getters, ordinal)) {
if (SqlDbType.Udt == metaData.SqlDbType) {
result = NullUdtInstance(metaData);
} else {
result = __typeSpecificNullForSqlValue[(int)metaData.SqlDbType];
}
} else {
switch (metaData.SqlDbType) {
case SqlDbType.Variant: // Handle variants specifically for v200, since they could contain v200 types
metaData = getters.GetVariantType(sink, ordinal);
sink.ProcessMessagesAndThrow();
Debug.Assert(SqlDbType.Variant != metaData.SqlDbType, "Variant-within-variant causes endless recursion!");
result = GetSqlValue200(sink, getters, ordinal, metaData, context);
break;
case SqlDbType.Date:
case SqlDbType.DateTime2:
result = GetDateTime_Unchecked(sink, getters, ordinal);
break;
case SqlDbType.Time:
result = GetTimeSpan_Unchecked(sink, getters, ordinal);
break;
case SqlDbType.DateTimeOffset:
result = GetDateTimeOffset_Unchecked(sink, getters, ordinal);
break;
default:
result = GetSqlValue(sink, getters, ordinal, metaData, context);
break;
}
}
return result;
}
开发者ID:uQr,项目名称:referencesource,代码行数:41,代码来源:ValueUtilsSmi.cs
示例4: SetIEnumerableOfSqlDataRecord_Unchecked
private static void SetIEnumerableOfSqlDataRecord_Unchecked(
SmiEventSink_Default sink,
SmiTypedGetterSetter setters,
int ordinal,
SmiMetaData metaData,
IEnumerable<SqlDataRecord> value,
ParameterPeekAheadValue peekAhead
) {
// Get target gettersetter
setters = setters.GetTypedGetterSetter(sink, ordinal);
sink.ProcessMessagesAndThrow();
IEnumerator<SqlDataRecord> enumerator = null;
try {
// Need to copy field metadata to an array to call FillCompatibleITypeSettersFromRecord
SmiExtendedMetaData[] mdFields = new SmiExtendedMetaData[metaData.FieldMetaData.Count];
metaData.FieldMetaData.CopyTo(mdFields, 0);
SmiDefaultFieldsProperty defaults = (SmiDefaultFieldsProperty) metaData.ExtendedProperties[SmiPropertySelector.DefaultFields];
int recordNumber = 1; // used only for reporting position when there are errors.
// obtain enumerator and handle any peekahead values
if (null != peekAhead && null != peekAhead.FirstRecord) {
// hook up to enumerator
enumerator = peekAhead.Enumerator;
// send the first record that was obtained earlier
setters.NewElement(sink);
sink.ProcessMessagesAndThrow();
FillCompatibleSettersFromRecord(sink, setters, mdFields, peekAhead.FirstRecord, defaults);
recordNumber++;
}
else {
enumerator = value.GetEnumerator();
}
using (enumerator) {
while(enumerator.MoveNext()) {
setters.NewElement(sink);
sink.ProcessMessagesAndThrow();
SqlDataRecord record = enumerator.Current;
if (record.FieldCount != mdFields.Length) {
throw SQL.EnumeratedRecordFieldCountChanged(recordNumber);
}
for(int i=0; i<record.FieldCount; i++) {
if (!MetaDataUtilsSmi.IsCompatible(metaData.FieldMetaData[i], record.GetSqlMetaData(i))) {
throw SQL.EnumeratedRecordMetaDataChanged(record.GetName(i), recordNumber);
}
}
FillCompatibleSettersFromRecord(sink, setters, mdFields, record, defaults);
recordNumber++;
}
setters.EndElements(sink);
sink.ProcessMessagesAndThrow();
}
}
finally {
// Clean up!
IDisposable disposable = enumerator as IDisposable;
if (null != disposable) {
disposable.Dispose();
}
}
}
开发者ID:uQr,项目名称:referencesource,代码行数:70,代码来源:ValueUtilsSmi.cs
示例5: SetDataTable_Unchecked
private static void SetDataTable_Unchecked(
SmiEventSink_Default sink,
SmiTypedGetterSetter setters,
int ordinal,
SmiMetaData metaData,
DataTable value
) {
// Get the target gettersetter
setters = setters.GetTypedGetterSetter(sink, ordinal);
sink.ProcessMessagesAndThrow();
// iterate over all records
// if first record was obtained earlier, use it prior to pulling more
ExtendedClrTypeCode[] cellTypes = new ExtendedClrTypeCode[metaData.FieldMetaData.Count];
for(int i=0; i<metaData.FieldMetaData.Count; i++) {
cellTypes[i] = ExtendedClrTypeCode.Invalid;
}
foreach(DataRow row in value.Rows) {
setters.NewElement(sink);
sink.ProcessMessagesAndThrow();
// Set all columns in the record
for(int i=0; i<metaData.FieldMetaData.Count; i++) {
SmiMetaData fieldMetaData = metaData.FieldMetaData[i];
if (row.IsNull(i)) {
SetDBNull_Unchecked(sink, setters, i);
}
else {
object cellValue = row[i];
// Only determine cell types for first row, to save expensive
if (ExtendedClrTypeCode.Invalid == cellTypes[i]) {
cellTypes[i] = MetaDataUtilsSmi.DetermineExtendedTypeCodeForUseWithSqlDbType(
fieldMetaData.SqlDbType, fieldMetaData.IsMultiValued, cellValue, fieldMetaData.Type,
//
SmiContextFactory.KatmaiVersion
);
}
SetCompatibleValueV200(sink, setters, i, fieldMetaData, cellValue, cellTypes[i], 0, NoLengthLimit, null);
}
}
}
setters.EndElements(sink);
sink.ProcessMessagesAndThrow();
}
开发者ID:uQr,项目名称:referencesource,代码行数:47,代码来源:ValueUtilsSmi.cs
示例6: GetTimeSpan_Unchecked
private static TimeSpan GetTimeSpan_Unchecked(SmiEventSink_Default sink, SmiTypedGetterSetter getters, int ordinal) {
Debug.Assert(!IsDBNull_Unchecked(sink, getters, ordinal));
TimeSpan result = getters.GetTimeSpan(sink, ordinal);
sink.ProcessMessagesAndThrow();
return result;
}
开发者ID:uQr,项目名称:referencesource,代码行数:7,代码来源:ValueUtilsSmi.cs
示例7: SetChars_FromReader
// Use chunking via SetChars to transfer a value from a reader to a gettersetter
private static void SetChars_FromReader(SmiEventSink_Default sink, SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, DbDataReader reader, int offset) {
int length = 0;
// Deal with large values by sending bufferLength of NoLengthLimit (== assume
// CheckXetParameters will ignore requested-length checks in this case)
length = CheckXetParameters(metaData.SqlDbType, metaData.MaxLength, NoLengthLimit /* actual */, 0, NoLengthLimit /* buffer length */, offset, NoLengthLimit /* requested length */ );
// Use fixed chunk size for all cases to avoid inquiring from reader.
int chunkSize;
if (MetaDataUtilsSmi.IsAnsiType(metaData.SqlDbType)) {
chunkSize = __maxByteChunkSize;
} else {
chunkSize = __maxCharChunkSize;
}
char[] buffer = new char[ chunkSize ];
long charsRead;
long charsWritten = 1; // prime value to get into write loop
long currentOffset = offset;
long lengthWritten = 0;
while ((length < 0 || lengthWritten < length) &&
0 != (charsRead = reader.GetChars(ordinal, currentOffset, buffer, 0, chunkSize)) &&
0 != charsWritten) {
charsWritten = setters.SetChars(sink, ordinal, currentOffset, buffer, 0, checked((int) charsRead));
sink.ProcessMessagesAndThrow();
checked{ currentOffset += charsWritten; }
checked{ lengthWritten += charsWritten; }
}
// Make sure to trim any left-over data (remember to trim at end of offset, not just the amount written
setters.SetCharsLength(sink, ordinal, currentOffset);
sink.ProcessMessagesAndThrow();
}
开发者ID:uQr,项目名称:referencesource,代码行数:35,代码来源:ValueUtilsSmi.cs
示例8: SetTimeSpan_Checked
private static void SetTimeSpan_Checked(SmiEventSink_Default sink, SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, TimeSpan value) {
VerifyTimeRange(metaData.SqlDbType, value);
SetTimeSpan_Unchecked(sink, setters, ordinal, value);
}
开发者ID:uQr,项目名称:referencesource,代码行数:4,代码来源:ValueUtilsSmi.cs
示例9: SetString_FromReader
private static void SetString_FromReader(SmiEventSink_Default sink, SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, DbDataReader reader, int offset)
{
string str = reader.GetString(ordinal);
int length = CheckXetParameters(metaData.SqlDbType, metaData.MaxLength, (long) str.Length, 0L, -1, offset, -1);
setters.SetString(sink, ordinal, str, offset, length);
sink.ProcessMessagesAndThrow();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ValueUtilsSmi.cs
示例10: SetIEnumerableOfSqlDataRecord_Unchecked
private static void SetIEnumerableOfSqlDataRecord_Unchecked(SmiEventSink_Default sink, SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, IEnumerable<SqlDataRecord> value, ParameterPeekAheadValue peekAhead)
{
setters = setters.GetTypedGetterSetter(sink, ordinal);
sink.ProcessMessagesAndThrow();
IEnumerator<SqlDataRecord> enumerator = null;
try
{
SmiExtendedMetaData[] array = new SmiExtendedMetaData[metaData.FieldMetaData.Count];
metaData.FieldMetaData.CopyTo(array, 0);
SmiDefaultFieldsProperty useDefaultValues = (SmiDefaultFieldsProperty) metaData.ExtendedProperties[SmiPropertySelector.DefaultFields];
int recordNumber = 1;
if ((peekAhead != null) && (peekAhead.FirstRecord != null))
{
enumerator = peekAhead.Enumerator;
setters.NewElement(sink);
sink.ProcessMessagesAndThrow();
FillCompatibleSettersFromRecord(sink, setters, array, peekAhead.FirstRecord, useDefaultValues);
recordNumber++;
}
else
{
enumerator = value.GetEnumerator();
}
using (enumerator)
{
while (enumerator.MoveNext())
{
setters.NewElement(sink);
sink.ProcessMessagesAndThrow();
SqlDataRecord current = enumerator.Current;
if (current.FieldCount != array.Length)
{
throw SQL.EnumeratedRecordFieldCountChanged(recordNumber);
}
for (int i = 0; i < current.FieldCount; i++)
{
if (!MetaDataUtilsSmi.IsCompatible(metaData.FieldMetaData[i], current.GetSqlMetaData(i)))
{
throw SQL.EnumeratedRecordMetaDataChanged(current.GetName(i), recordNumber);
}
}
FillCompatibleSettersFromRecord(sink, setters, array, current, useDefaultValues);
recordNumber++;
}
setters.EndElements(sink);
sink.ProcessMessagesAndThrow();
}
}
finally
{
IDisposable disposable = enumerator;
if (disposable != null)
{
disposable.Dispose();
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:57,代码来源:ValueUtilsSmi.cs
示例11: SetDataTable_Unchecked
private static void SetDataTable_Unchecked(SmiEventSink_Default sink, SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, DataTable value)
{
setters = setters.GetTypedGetterSetter(sink, ordinal);
sink.ProcessMessagesAndThrow();
ExtendedClrTypeCode[] codeArray = new ExtendedClrTypeCode[metaData.FieldMetaData.Count];
for (int i = 0; i < metaData.FieldMetaData.Count; i++)
{
codeArray[i] = ExtendedClrTypeCode.Invalid;
}
foreach (DataRow row in value.Rows)
{
setters.NewElement(sink);
sink.ProcessMessagesAndThrow();
for (int j = 0; j < metaData.FieldMetaData.Count; j++)
{
SmiMetaData data = metaData.FieldMetaData[j];
if (row.IsNull(j))
{
SetDBNull_Unchecked(sink, setters, j);
}
else
{
object obj2 = row[j];
if (ExtendedClrTypeCode.Invalid == codeArray[j])
{
codeArray[j] = MetaDataUtilsSmi.DetermineExtendedTypeCodeForUseWithSqlDbType(data.SqlDbType, data.IsMultiValued, obj2, data.Type, 210L);
}
SetCompatibleValueV200(sink, setters, j, data, obj2, codeArray[j], 0, -1, null);
}
}
}
setters.EndElements(sink);
sink.ProcessMessagesAndThrow();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:34,代码来源:ValueUtilsSmi.cs
示例12: SetCompatibleValueV200
internal static void SetCompatibleValueV200(SmiEventSink_Default sink, SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, object value, ExtendedClrTypeCode typeCode, int offset, int length, ParameterPeekAheadValue peekAhead)
{
switch (typeCode)
{
case ExtendedClrTypeCode.DataTable:
SetDataTable_Unchecked(sink, setters, ordinal, metaData, (DataTable) value);
return;
case ExtendedClrTypeCode.DbDataReader:
SetDbDataReader_Unchecked(sink, setters, ordinal, metaData, (DbDataReader) value);
return;
case ExtendedClrTypeCode.IEnumerableOfSqlDataRecord:
SetIEnumerableOfSqlDataRecord_Unchecked(sink, setters, ordinal, metaData, (IEnumerable<SqlDataRecord>) value, peekAhead);
return;
case ExtendedClrTypeCode.TimeSpan:
SetTimeSpan_Checked(sink, setters, ordinal, metaData, (TimeSpan) value);
return;
case ExtendedClrTypeCode.DateTimeOffset:
SetDateTimeOffset_Unchecked(sink, setters, ordinal, (DateTimeOffset) value);
return;
}
SetCompatibleValue(sink, setters, ordinal, metaData, value, typeCode, offset);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:ValueUtilsSmi.cs
示例13: SetChars_FromReader
private static void SetChars_FromReader(SmiEventSink_Default sink, SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, DbDataReader reader, int offset)
{
int num4;
long num6;
int num5 = 0;
num5 = CheckXetParameters(metaData.SqlDbType, metaData.MaxLength, -1L, 0L, -1, offset, -1);
if (MetaDataUtilsSmi.IsAnsiType(metaData.SqlDbType))
{
num4 = 0x1f40;
}
else
{
num4 = 0xfa0;
}
char[] buffer = new char[num4];
long num2 = 1L;
long dataOffset = offset;
for (long i = 0L; ((num5 < 0) || (i < num5)) && ((0L != (num6 = reader.GetChars(ordinal, dataOffset, buffer, 0, num4))) && (0L != num2)); i += num2)
{
num2 = setters.SetChars(sink, ordinal, dataOffset, buffer, 0, (int) num6);
sink.ProcessMessagesAndThrow();
dataOffset += num2;
}
setters.SetCharsLength(sink, ordinal, dataOffset);
sink.ProcessMessagesAndThrow();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:ValueUtilsSmi.cs
示例14: SetBytes_FromReader
private static void SetBytes_FromReader(SmiEventSink_Default sink, SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, DbDataReader reader, int offset)
{
long num6;
int num4 = 0;
num4 = CheckXetParameters(metaData.SqlDbType, metaData.MaxLength, -1L, 0L, -1, offset, -1);
int length = 0x1f40;
byte[] buffer = new byte[length];
long num2 = 1L;
long dataOffset = offset;
for (long i = 0L; ((num4 < 0) || (i < num4)) && ((0L != (num6 = reader.GetBytes(ordinal, dataOffset, buffer, 0, length))) && (0L != num2)); i += num2)
{
num2 = setters.SetBytes(sink, ordinal, dataOffset, buffer, 0, (int) num6);
sink.ProcessMessagesAndThrow();
dataOffset += num2;
}
setters.SetBytesLength(sink, ordinal, dataOffset);
sink.ProcessMessagesAndThrow();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:18,代码来源:ValueUtilsSmi.cs
示例15: GetValue200
internal static object GetValue200(SmiEventSink_Default sink, SmiTypedGetterSetter getters, int ordinal, SmiMetaData metaData, SmiContext context)
{
if (IsDBNull_Unchecked(sink, getters, ordinal))
{
return DBNull.Value;
}
switch (metaData.SqlDbType)
{
case SqlDbType.Date:
case SqlDbType.DateTime2:
return GetDateTime_Unchecked(sink, getters, ordinal);
case SqlDbType.Time:
return GetTimeSpan_Unchecked(sink, getters, ordinal);
case SqlDbType.DateTimeOffset:
return GetDateTimeOffset_Unchecked(sink, getters, ordinal);
case SqlDbType.Variant:
metaData = getters.GetVariantType(sink, ordinal);
sink.ProcessMessagesAndThrow();
return GetValue200(sink, getters, ordinal, metaData, context);
}
return GetValue(sink, getters, ordinal, metaData, context);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:ValueUtilsSmi.cs
示例16: FillCompatibleSettersFromReader
// Copy multiple fields from reader to SmiTypedGetterSetter
// Supports V200 code path, without damaging backward compat for V100 code.
// Main differences are supporting DbDataReader, and for binary, character, decimal and Udt types.
// Assumes caller enforces that reader and setter metadata are compatible
internal static void FillCompatibleSettersFromReader(SmiEventSink_Default sink, SmiTypedGetterSetter setters, IList<SmiExtendedMetaData> metaData, DbDataReader reader) {
for (int i = 0; i < metaData.Count; i++) {
if (reader.IsDBNull(i)) {
ValueUtilsSmi.SetDBNull_Unchecked(sink, setters, i);
}
else {
switch (metaData[i].SqlDbType) {
case SqlDbType.BigInt:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Int64));
SetInt64_Unchecked(sink, setters, i, reader.GetInt64(i));
break;
case SqlDbType.Binary:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.ByteArray));
SetBytes_FromReader(sink, setters, i, metaData[i], reader, 0);
break;
case SqlDbType.Bit:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Boolean));
SetBoolean_Unchecked(sink, setters, i, reader.GetBoolean(i));
break;
case SqlDbType.Char:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.CharArray));
SetCharsOrString_FromReader(sink, setters, i, metaData[i], reader, 0);
break;
case SqlDbType.DateTime:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.DateTime));
SetDateTime_Checked(sink, setters, i, metaData[i], reader.GetDateTime(i));
break;
case SqlDbType.Decimal: { // block to scope sqlReader local to avoid conflicts
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlDecimal));
// Support full fidelity for SqlDataReader
SqlDataReader sqlReader = reader as SqlDataReader;
if (null != sqlReader) {
SetSqlDecimal_Unchecked(sink, setters, i, sqlReader.GetSqlDecimal(i));
}
else {
SetSqlDecimal_Unchecked(sink, setters, i, new SqlDecimal(reader.GetDecimal(i)));
}
}
break;
case SqlDbType.Float:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Double));
SetDouble_Unchecked(sink, setters, i, reader.GetDouble(i));
break;
case SqlDbType.Image:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.ByteArray));
SetBytes_FromReader(sink, setters, i, metaData[i], reader, 0);
break;
case SqlDbType.Int:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Int32));
SetInt32_Unchecked(sink, setters, i, reader.GetInt32(i));
break;
case SqlDbType.Money:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlMoney));
SetSqlMoney_Checked(sink, setters, i, metaData[i], new SqlMoney(reader.GetDecimal(i)));
break;
case SqlDbType.NChar:
case SqlDbType.NText:
case SqlDbType.NVarChar:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.CharArray));
SetCharsOrString_FromReader(sink, setters, i, metaData[i], reader, 0);
break;
case SqlDbType.Real:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Single));
SetSingle_Unchecked(sink, setters, i, reader.GetFloat(i));
break;
case SqlDbType.UniqueIdentifier:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Guid));
SetGuid_Unchecked(sink, setters, i, reader.GetGuid(i));
break;
case SqlDbType.SmallDateTime:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.DateTime));
SetDateTime_Checked(sink, setters, i,metaData[i], reader.GetDateTime(i));
break;
case SqlDbType.SmallInt:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Int16));
SetInt16_Unchecked(sink, setters, i, reader.GetInt16(i));
break;
case SqlDbType.SmallMoney:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlMoney));
SetSqlMoney_Checked(sink, setters, i, metaData[i], new SqlMoney(reader.GetDecimal(i)));
break;
case SqlDbType.Text:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.CharArray));
SetCharsOrString_FromReader(sink, setters, i, metaData[i], reader, 0);
break;
case SqlDbType.Timestamp:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.ByteArray));
SetBytes_FromReader(sink, setters, i, metaData[i], reader, 0);
break;
case SqlDbType.TinyInt:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Byte));
SetByte_Unchecked(sink, setters, i, reader.GetByte(i));
break;
case SqlDbType.VarBinary:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.ByteArray));
SetBytes_FromReader(sink, setters, i, metaData[i], reader, 0);
//.........这里部分代码省略.........
开发者ID:uQr,项目名称:referencesource,代码行数:101,代码来源:ValueUtilsSmi.cs
示例17: FillCompatibleSettersFromRecord
internal static void FillCompatibleSettersFromRecord(SmiEventSink_Default sink, SmiTypedGetterSetter setters, SmiMetaData[] metaData, SqlDataRecord record, SmiDefaultFieldsProperty useDefaultValues)
{
for (int i = 0; i < metaData.Length; ++i)
{
if (null != useDefaultValues && useDefaultValues[i])
{
continue;
}
if (record.IsDBNull(i))
{
ValueUtilsSmi.SetDBNull_Unchecked(sink, setters, i);
}
else
{
switch (metaData[i].SqlDbType)
{
case SqlDbType.BigInt:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Int64));
SetInt64_Unchecked(sink, setters, i, record.GetInt64(i));
break;
case SqlDbType.Binary:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlBytes));
SetBytes_FromRecord(sink, setters, i, metaData[i], record, 0);
break;
case SqlDbType.Bit:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Boolean));
SetBoolean_Unchecked(sink, setters, i, record.GetBoolean(i));
break;
case SqlDbType.Char:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlChars));
SetChars_FromRecord(sink, setters, i, metaData[i], record, 0);
break;
case SqlDbType.DateTime:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.DateTime));
SetDateTime_Checked(sink, setters, i, metaData[i], record.GetDateTime(i));
break;
case SqlDbType.Decimal:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlDecimal));
SetSqlDecimal_Unchecked(sink, setters, i, record.GetSqlDecimal(i));
break;
case SqlDbType.Float:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Double));
SetDouble_Unchecked(sink, setters, i, record.GetDouble(i));
break;
case SqlDbType.Image:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlBytes));
SetBytes_FromRecord(sink, setters, i, metaData[i], record, 0);
break;
case SqlDbType.Int:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Int32));
SetInt32_Unchecked(sink, setters, i, record.GetInt32(i));
break;
case SqlDbType.Money:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlMoney));
SetSqlMoney_Unchecked(sink, setters, i, metaData[i], record.GetSqlMoney(i));
break;
case SqlDbType.NChar:
case SqlDbType.NText:
case SqlDbType.NVarChar:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlChars));
SetChars_FromRecord(sink, setters, i, metaData[i], record, 0);
break;
case SqlDbType.Real:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Single));
SetSingle_Unchecked(sink, setters, i, record.GetFloat(i));
break;
case SqlDbType.UniqueIdentifier:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Guid));
SetGuid_Unchecked(sink, setters, i, record.GetGuid(i));
break;
case SqlDbType.SmallDateTime:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.DateTime));
SetDateTime_Checked(sink, setters, i, metaData[i], record.GetDateTime(i));
break;
case SqlDbType.SmallInt:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Int16));
SetInt16_Unchecked(sink, setters, i, record.GetInt16(i));
break;
case SqlDbType.SmallMoney:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlMoney));
SetSqlMoney_Checked(sink, setters, i, metaData[i], record.GetSqlMoney(i));
break;
case SqlDbType.Text:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlChars));
SetChars_FromRecord(sink, setters, i, metaData[i], record, 0);
break;
case SqlDbType.Timestamp:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlBytes));
SetBytes_FromRecord(sink, setters, i, metaData[i], record, 0);
break;
case SqlDbType.TinyInt:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.Byte));
SetByte_Unchecked(sink, setters, i, record.GetByte(i));
break;
case SqlDbType.VarBinary:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.SqlBytes));
SetBytes_FromRecord(sink, setters, i, metaData[i], record, 0);
break;
case SqlDbType.VarChar:
Debug.Assert(CanAccessSetterDirectly(metaData[i], ExtendedClrTypeCode.String));
//.........这里部分代码省略.........
开发者ID:uQr,项目名称:referencesource,代码行数:101,代码来源:ValueUtilsSmi.cs
示例18: FillCompatibleSettersFromReader
internal static void FillCompatibleSettersFromReader(SmiEventSink_Default sink, SmiTypedGetterSetter setters, IList<SmiExtendedMetaData> metaData, DbDataReader reader)
{
for (int i = 0; i < metaData.Count; i++)
{
object sqlValue;
DateTimeOffset dateTimeOffset;
TimeSpan timeSpan;
ExtendedClrTypeCode code;
if (reader.IsDBNull(i))
{
SetDBNull_Unchecked(sink, setters, i);
continue;
}
switch (metaData[i].SqlDbType)
{
case SqlDbType.BigInt:
{
SetInt64_Unchecked(sink, setters, i, reader.GetInt64(i));
continue;
}
case SqlDbType.Binary:
{
SetBytes_FromReader(sink, setters, i, metaData[i], reader, 0);
continue;
}
case SqlDbType.Bit:
{
SetBoolean_Unchecked(sink, setters, i, reader.GetBoolean(i));
continue;
}
case SqlDbType.Char:
{
SetCharsOrString_FromReader(sink, setters, i, metaData[i], reader, 0);
continue;
}
case SqlDbType.DateTime:
{
SetDateTime_Checked(sink, setters, i, metaData[i], reader.GetDateTime(i));
continue;
}
case SqlDbType.Decimal:
{
SqlDataReader reader6 = reader as SqlDataReader;
if (reader6 == null)
{
break;
}
SetSqlDecimal_Unchecked(sink, setters, i, reader6.GetSqlDecimal(i));
continue;
}
case SqlDbType.Float:
{
SetDouble_Unchecked(sink, setters, i, reader.GetDouble(i));
continue;
}
case SqlDbType.Image:
{
SetBytes_FromReader(sink, setters, i, metaData[i], reader, 0);
continue;
}
case SqlDbType.Int:
{
SetInt32_Unchecked(sink, setters, i, reader.GetInt32(i));
continue;
}
case SqlDbType.Money:
{
SetSqlMoney_Checked(sink, setters, i, metaData[i], new SqlMoney(reader.GetDecimal(i)));
continue;
}
case SqlDbType.NChar:
case SqlDbType.NText:
case SqlDbType.NVarChar:
{
SetCharsOrString_FromReader(sink, setters, i, metaData[i], reader, 0);
continue;
}
case SqlDbType.Real:
{
SetSingle_Unchecked(sink, setters, i, reader.GetFloat(i));
continue;
}
case SqlDbType.UniqueIdentifier:
{
SetGuid_Unchecked(sink, setters, i, reader.GetGuid(i));
continue;
}
case SqlDbType.SmallDateTime:
{
SetDateTime_Checked(sink, setters, i, metaData[i], reader.GetDateTime(i));
continue;
}
case SqlDbType.SmallInt:
{
SetInt16_Unchecked(sink, setters, i, reader.GetInt16(i));
continue;
}
case SqlDbType.SmallMoney:
{
SetSqlMoney_Checked(sink, setters, i, metaData[i], new SqlMoney(reader.GetDecimal(i)));
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:ValueUtilsSmi.cs
示例19: SetCharsOrString_FromReader
// Transfer a character value from a reader when we're not sure which GetXXX method the reader will support.
// Prefers to chunk data via GetChars, but falls back to GetString if that fails.
// Mainly put in place because DataTableReader doesn't support GetChars on string columns, but others could fail too...
private static void SetCharsOrString_FromReader(SmiEventSink_Default sink, SmiTypedGetterSetter setters, int ordinal, SmiMetaData metaData, DbDataReader reader, int offset) {
bool success = false;
try {
SetChars_FromReader(sink, setters, ordinal, metaData, reader, offset);
success = true;
}
catch(Exception e) {
if (!ADP.IsCatchableExceptionType(e)) {
throw;
}
}
if (!success) {
SetString_FromReader(sink, setters, ordinal, metaData, reader, off
|
请发表评论