本文整理汇总了C#中MySql.Data.MySqlClient.MySqlDataReader.GetSByte方法的典型用法代码示例。如果您正苦于以下问题:C# MySqlDataReader.GetSByte方法的具体用法?C# MySqlDataReader.GetSByte怎么用?C# MySqlDataReader.GetSByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySql.Data.MySqlClient.MySqlDataReader
的用法示例。
在下文中一共展示了MySqlDataReader.GetSByte方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetValue
// 取 dr 中某字段的数据并返回
public static object GetValue( DbColumn col, MySqlDataReader r, int idx )
{
switch( col.dataType )
{
case DbDataTypes.Boolean:
return r.GetBoolean( idx );
case DbDataTypes.Int8:
return r.GetSByte( idx );
case DbDataTypes.Int16:
return r.GetInt16( idx );
case DbDataTypes.Int32:
return r.GetInt32( idx );
case DbDataTypes.Int64:
return r.GetInt64( idx );
case DbDataTypes.UInt8:
return r.GetByte( idx );
case DbDataTypes.UInt16:
return r.GetUInt16( idx );
case DbDataTypes.UInt32:
return r.GetUInt32( idx );
case DbDataTypes.UInt64:
return r.GetUInt64( idx );
case DbDataTypes.Float:
return r.GetFloat( idx );
case DbDataTypes.Double:
return r.GetDouble( idx );
case DbDataTypes.DateTime:
return r.GetDateTime( idx );
case DbDataTypes.String:
return r.GetString( idx );
case DbDataTypes.Bytes:
var len = (int)r.GetBytes( idx, 0, null, 0, 0 );
var buf = new byte[ len ];
r.GetBytes( idx, 0, buf, 0, len );
return buf;
default:
throw new Exception( "unsupported DbType" );
}
}
示例2: _EventRead
private static Event _EventRead(Engine engine, MySqlDataReader dataReader)
{
Event aEvent = new Event(engine);
uint flags = dataReader.IsDBNull(dataReader.GetOrdinal("flagsEvent")) ? 0 : dataReader.GetUInt32("flagsEvent");
aEvent._idRundownEvent = dataReader.GetUInt64("idRundownEvent");
aEvent._layer = (VideoLayer)dataReader.GetSByte("Layer");
aEvent._eventType = (TEventType)dataReader.GetByte("typEvent");
aEvent._startType = (TStartType)dataReader.GetByte("typStart");
aEvent._scheduledTime = _readDateTimeField(dataReader, "ScheduledTime");
aEvent._duration = dataReader.IsDBNull(dataReader.GetOrdinal("Duration")) ? default(TimeSpan) : aEvent.Engine.AlignTimeSpan(dataReader.GetTimeSpan("Duration"));
aEvent._scheduledDelay = dataReader.IsDBNull(dataReader.GetOrdinal("ScheduledDelay")) ? default(TimeSpan) : aEvent.Engine.AlignTimeSpan(dataReader.GetTimeSpan("ScheduledDelay"));
aEvent._scheduledTC = dataReader.IsDBNull(dataReader.GetOrdinal("ScheduledTC")) ? TimeSpan.Zero : dataReader.GetTimeSpan("ScheduledTC");
aEvent._mediaGuid = (dataReader.IsDBNull(dataReader.GetOrdinal("MediaGuid"))) ? Guid.Empty : dataReader.GetGuid("MediaGuid");
aEvent._eventName = dataReader.IsDBNull(dataReader.GetOrdinal("EventName")) ? default(string) : dataReader.GetString("EventName");
var psb = dataReader.GetByte("PlayState");
aEvent._playState = (TPlayState)psb;
if (aEvent._playState == TPlayState.Playing || aEvent._playState == TPlayState.Paused)
aEvent._playState = TPlayState.Aborted;
if (aEvent._playState == TPlayState.Fading)
aEvent._playState = TPlayState.Played;
aEvent._startTime = _readDateTimeField(dataReader, "StartTime");
aEvent._startTC = dataReader.IsDBNull(dataReader.GetOrdinal("StartTC")) ? TimeSpan.Zero : dataReader.GetTimeSpan("StartTC");
aEvent._requestedStartTime = dataReader.IsDBNull(dataReader.GetOrdinal("RequestedStartTime")) ? null : (TimeSpan?)dataReader.GetTimeSpan("RequestedStartTime");
aEvent._transitionTime = dataReader.IsDBNull(dataReader.GetOrdinal("TransitionTime")) ? default(TimeSpan) : dataReader.GetTimeSpan("TransitionTime");
aEvent._transitionType = (TTransitionType)dataReader.GetByte("typTransition");
aEvent._audioVolume = dataReader.IsDBNull(dataReader.GetOrdinal("AudioVolume")) ? 0 : dataReader.GetDecimal("AudioVolume");
aEvent._idProgramme = dataReader.IsDBNull(dataReader.GetOrdinal("idProgramme")) ? 0 : dataReader.GetUInt64("idProgramme");
aEvent._idAux = dataReader.IsDBNull(dataReader.GetOrdinal("IdAux")) ? default(string) : dataReader.GetString("IdAux");
aEvent._enabled = (flags & (1 << 0)) != 0;
aEvent._hold = (flags & (1 << 1)) != 0;
EventGPI.FromUInt64(ref aEvent._gPI, (flags >> 4) & EventGPI.Mask);
aEvent._nextLoaded = false;
return aEvent;
}
示例3: FillValue
// 往 dr 填充 r 于 i 索引的值
public static void FillValue( DbRow dr, MySqlDataReader r, int i )
{
switch( dr.parent.columns[ i ].dataType )
{
case DbDataTypes.Boolean:
dr[ i ].Assign( r.GetBoolean( i ) ); break;
case DbDataTypes.Int8:
dr[ i ].Assign( r.GetSByte( i ) ); break;
case DbDataTypes.Int16:
dr[ i ].Assign( r.GetInt16( i ) ); break;
case DbDataTypes.Int32:
dr[ i ].Assign( r.GetInt32( i ) ); break;
case DbDataTypes.Int64:
dr[ i ].Assign( r.GetInt64( i ) ); break;
case DbDataTypes.UInt8:
dr[ i ].Assign( r.GetByte( i ) ); break;
case DbDataTypes.UInt16:
dr[ i ].Assign( r.GetUInt16( i ) ); break;
case DbDataTypes.UInt32:
dr[ i ].Assign( r.GetUInt32( i ) ); break;
case DbDataTypes.UInt64:
dr[ i ].Assign( r.GetUInt64( i ) ); break;
case DbDataTypes.Float:
dr[ i ].Assign( r.GetFloat( i ) ); break;
case DbDataTypes.Double:
dr[ i ].Assign( r.GetDouble( i ) ); break;
case DbDataTypes.DateTime:
dr[ i ].Assign( r.GetDateTime( i ) ); break;
case DbDataTypes.String:
dr[ i ].Assign( r.GetString( i ) ); break;
case DbDataTypes.Bytes:
var len = (int)r.GetBytes( i, 0, null, 0, 0 );
var buf = new byte[ len ];
r.GetBytes( i, 0, buf, 0, len );
dr[ i ].Assign( buf );
break;
default:
break;
}
}