本文整理汇总了C#中Microsoft.SqlServer.Server.SmiMetaData类的典型用法代码示例。如果您正苦于以下问题:C# SmiMetaData类的具体用法?C# SmiMetaData怎么用?C# SmiMetaData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SmiMetaData类属于Microsoft.SqlServer.Server命名空间,在下文中一共展示了SmiMetaData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetBytesConversion
private static long GetBytesConversion(SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData, long fieldOffset, byte[] buffer, int bufferOffset, int length, bool throwOnNull) {
object obj = GetSqlValue( sink, getters, ordinal, metaData, null );
if (null == obj) {
throw ADP.InvalidCast();
}
SqlBinary value = (SqlBinary) obj;
if (value.IsNull) {
if (throwOnNull) {
throw SQL.SqlNullValue();
}
else {
// return zero length in any case
return 0;
}
}
if ( null == buffer ) {
return value.Length;
}
length = CheckXetParameters( metaData.SqlDbType, metaData.MaxLength * sizeof(char), value.Length,
fieldOffset, buffer.Length, bufferOffset, length );
Array.Copy( value.Value, checked((int)fieldOffset), buffer, bufferOffset, length );
return length;
}
开发者ID:uQr,项目名称:referencesource,代码行数:26,代码来源:ValueUtilsSmi.cs
示例2: TdsValueSetter
internal TdsValueSetter(TdsParserStateObject stateObj, SmiMetaData md)
{
this._stateObj = stateObj;
this._metaData = md;
this._isPlp = MetaDataUtilsSmi.IsPlpFormat(md);
this._plpUnknownSent = false;
this._encoder = null;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:TdsValueSetter.cs
示例3: SmiSettersStream
internal SmiSettersStream(SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SmiMetaData metaData)
{
this._sink = sink;
this._setters = setters;
this._ordinal = ordinal;
this._lengthWritten = 0L;
this._metaData = metaData;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:SmiSettersStream.cs
示例4: SmiGettersStream
internal SmiGettersStream(SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData)
{
this._sink = sink;
this._getters = getters;
this._ordinal = ordinal;
this._readPosition = 0L;
this._metaData = metaData;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:SmiGettersStream.cs
示例5: MemoryRecordBuffer
internal MemoryRecordBuffer(SmiMetaData[] metaData) {
Debug.Assert(null != metaData, "invalid attempt to instantiate MemoryRecordBuffer with null SmiMetaData[]");
_buffer = new SqlRecordBuffer[metaData.Length];
for (int i = 0; i < _buffer.Length; ++i) {
_buffer[i] = new SqlRecordBuffer(metaData[i]);
}
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:9,代码来源:MemoryRecordBuffer.cs
示例6: TdsRecordBufferSetter
internal TdsRecordBufferSetter(TdsParserStateObject stateObj, SmiMetaData md)
{
this._fieldSetters = new TdsValueSetter[md.FieldMetaData.Count];
for (int i = 0; i < md.FieldMetaData.Count; i++)
{
this._fieldSetters[i] = new TdsValueSetter(stateObj, md.FieldMetaData[i]);
}
this._stateObj = stateObj;
this._metaData = md;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:TdsRecordBufferSetter.cs
示例7: TdsValueSetter
private int _currentOffset; // for chunking, verify that caller is using correct offsets
#endif
#endregion
#region Exposed Construct/factory methods
internal TdsValueSetter(TdsParserStateObject stateObj, SmiMetaData md) {
_stateObj = stateObj;
_metaData = md;
_isPlp = MetaDataUtilsSmi.IsPlpFormat(md);
_plpUnknownSent = false;
_encoder = null;
#if DEBUG
_currentOffset = 0;
#endif
}
开发者ID:uQr,项目名称:referencesource,代码行数:17,代码来源:TdsValueSetter.cs
示例8: GetByte
internal static byte GetByte( SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData ) {
ThrowIfITypedGettersIsNull( sink, getters, ordinal );
if ( CanAccessGetterDirectly( metaData, ExtendedClrTypeCode.Byte ) ) {
return GetByte_Unchecked( sink, getters, ordinal );
}
object result = GetValue( sink, getters, ordinal, metaData, null );
if (null == result) {
throw ADP.InvalidCast();
}
return (Byte)result;
}
开发者ID:uQr,项目名称:referencesource,代码行数:11,代码来源:ValueUtilsSmi.cs
示例9: SmiGettersStream
internal SmiGettersStream( SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData ) {
Debug.Assert( null != sink );
Debug.Assert( null != getters );
Debug.Assert( 0 <= ordinal );
Debug.Assert( null != metaData );
_sink = sink;
_getters = getters;
_ordinal = ordinal;
_readPosition = 0;
_metaData = metaData;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:12,代码来源:SmiGettersStream.cs
示例10: TdsRecordBufferSetter
private int _currentField; // validate that caller sets columns in correct order.
#endif
#endregion
#region Exposed Construct and control methods/properties
internal TdsRecordBufferSetter(TdsParserStateObject stateObj, SmiMetaData md) {
Debug.Assert(SqlDbType.Structured == md.SqlDbType, "Unsupported SqlDbType: " + md.SqlDbType);
_fieldSetters = new TdsValueSetter[md.FieldMetaData.Count];
for(int i=0; i<md.FieldMetaData.Count; i++) {
_fieldSetters[i] = new TdsValueSetter(stateObj, md.FieldMetaData[i]);
}
_stateObj = stateObj;
_metaData = md;
#if DEBUG
_currentField = ReadyForToken;
#endif
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:19,代码来源:TdsRecordBufferSetter.cs
示例11: SmiSettersStream
internal SmiSettersStream( SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SmiMetaData metaData ) {
Debug.Assert( null != sink );
Debug.Assert( null != setters );
Debug.Assert( 0 <= ordinal );
Debug.Assert( null != metaData );
_sink = sink;
_setters = setters;
_ordinal = ordinal;
_lengthWritten = 0;
_metaData = metaData;
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:12,代码来源:SmiSettersStream.cs
示例12: GetSqlXml
internal static SqlXml GetSqlXml( SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData, SmiContext context ) {
SqlXml result;
if ( CanAccessGetterDirectly( metaData, ExtendedClrTypeCode.SqlXml ) ) {
if ( IsDBNull_Unchecked( sink, getters, ordinal ) ) {
result = SqlXml.Null;
}
else {
result = GetSqlXml_Unchecked( sink, getters, ordinal, context );
}
}
else {
object obj = GetSqlValue( sink, getters, ordinal, metaData, null );
if (null == obj) {
throw ADP.InvalidCast();
}
result = (SqlXml) obj;
}
return result;
}
开发者ID:uQr,项目名称:referencesource,代码行数:20,代码来源:ValueUtilsSmi.cs
示例13: GetSqlString
internal static SqlString GetSqlString( SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData ) {
SqlString result;
if ( CanAccessGetterDirectly( metaData, ExtendedClrTypeCode.SqlString ) ) {
if ( IsDBNull_Unchecked( sink, getters, ordinal ) ) {
result = SqlString.Null;
}
else {
String temp = GetString_Unchecked( sink, getters, ordinal );
result = new SqlString( temp );
}
}
else if (SqlDbType.Xml == metaData.SqlDbType) {
SqlXml xmlValue = GetSqlXml_Unchecked( sink, getters, ordinal, null );
if (xmlValue.IsNull) {
result = SqlString.Null;
}
else {
result = new SqlString( xmlValue.Value );
}
}
else {
object obj = GetSqlValue( sink, getters, ordinal, metaData, null );
if (null == obj) {
throw ADP.InvalidCast();
}
result = (SqlString) obj;
}
return result;
}
开发者ID:uQr,项目名称:referencesource,代码行数:31,代码来源:ValueUtilsSmi.cs
示例14: GetTimeSpan
// dealing with v200 SMI
internal static TimeSpan GetTimeSpan(SmiEventSink_Default sink, SmiTypedGetterSetter getters, int ordinal, SmiMetaData metaData) {
ThrowIfITypedGettersIsNull(sink, getters, ordinal);
if (CanAccessGetterDirectly(metaData, ExtendedClrTypeCode.TimeSpan)) {
return GetTimeSpan_Unchecked(sink, getters, ordinal);
}
return (TimeSpan)GetValue200(sink, getters, ordinal, metaData, null);
}
开发者ID:uQr,项目名称:referencesource,代码行数:8,代码来源:ValueUtilsSmi.cs
示例15: GetTextReader
internal static TextReader GetTextReader( SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData ) {
bool isDbNull = ValueUtilsSmi.IsDBNull_Unchecked(sink, getters, ordinal);
// If a sql_variant, get the internal type
if ((!isDbNull) && (metaData.SqlDbType == SqlDbType.Variant)) {
metaData = getters.GetVariantType(sink, ordinal);
}
// If the SqlDbType is still variant, then it must contain null, so don't throw InvalidCast
if ((metaData.SqlDbType != SqlDbType.Variant) && (!CanAccessGetterDirectly(metaData, ExtendedClrTypeCode.TextReader))) {
throw ADP.InvalidCast();
}
string data;
if (isDbNull) {
// "null" textreader
data = string.Empty;
}
else {
// Read all data
data = GetString_Unchecked(sink, getters, ordinal);
}
// Wrap in pre-built object
return new StringReader(data);
}
开发者ID:uQr,项目名称:referencesource,代码行数:25,代码来源:ValueUtilsSmi.cs
示例16: SetSqlString_Unchecked
private static void SetSqlString_Unchecked( SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SmiMetaData metaData, SqlString value, int offset, int length ) {
if ( value.IsNull ) {
setters.SetDBNull( sink, ordinal );
sink.ProcessMessagesAndThrow();
}
else {
if (SqlDbType.Variant == metaData.SqlDbType) {
// Set up a NVarChar metadata with correct LCID/Collation
metaData = new SmiMetaData(
SqlDbType.NVarChar,
SmiMetaData.MaxUnicodeCharacters,
0,
0,
value.LCID,
value.SqlCompareOptions,
null);
setters.SetVariantMetaData( sink, ordinal, metaData );
sink.ProcessMessagesAndThrow();
}
SetString_Unchecked( sink, setters, ordinal, value.Value, offset, length );
}
}
开发者ID:uQr,项目名称:referencesource,代码行数:22,代码来源:ValueUtilsSmi.cs
示例17: SetSqlMoney_Unchecked
private static void SetSqlMoney_Unchecked( SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SmiMetaData metaData, SqlMoney value ) {
if ( value.IsNull ) {
setters.SetDBNull( sink, ordinal );
}
else {
if ( SqlDbType.Variant == metaData.SqlDbType ) {
setters.SetVariantMetaData( sink, ordinal, SmiMetaData.DefaultMoney );
sink.ProcessMessagesAndThrow();
}
setters.SetInt64( sink, ordinal, value.ToSqlInternalRepresentation() );
}
sink.ProcessMessagesAndThrow();
}
开发者ID:uQr,项目名称:referencesource,代码行数:14,代码来源:ValueUtilsSmi.cs
示例18: GetString
internal static String GetString( SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData ) {
ThrowIfITypedGettersIsNull( sink, getters, ordinal );
if ( CanAccessGetterDirectly( metaData, ExtendedClrTypeCode.String ) ) {
return GetString_Unchecked( sink, getters, ordinal );
}
object obj = GetValue( sink, getters, ordinal, metaData, null );
if (null == obj) {
throw ADP.InvalidCast();
}
return (String) obj;
}
开发者ID:uQr,项目名称:referencesource,代码行数:11,代码来源:ValueUtilsSmi.cs
示例19: GetSequentialTextReader
internal static SqlSequentialTextReaderSmi GetSequentialTextReader( SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData ) {
Debug.Assert(!ValueUtilsSmi.IsDBNull_Unchecked(sink, getters, ordinal), "Should not try to get a SqlSequentialTextReaderSmi on a null column");
ThrowIfITypedGettersIsNull( sink, getters, ordinal );
if ( !CanAccessGetterDirectly( metaData, ExtendedClrTypeCode.TextReader ) ) {
throw ADP.InvalidCast();
}
// This will advance the column to ordinal
long length = GetCharsLength_Unchecked(sink, getters, ordinal);
return new SqlSequentialTextReaderSmi(sink, getters, ordinal, length);
}
开发者ID:uQr,项目名称:referencesource,代码行数:11,代码来源:ValueUtilsSmi.cs
示例20: 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
注:本文中的Microsoft.SqlServer.Server.SmiMetaData类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论