本文整理汇总了C#中OracleDataReader.GetOracleValue方法的典型用法代码示例。如果您正苦于以下问题:C# OracleDataReader.GetOracleValue方法的具体用法?C# OracleDataReader.GetOracleValue怎么用?C# OracleDataReader.GetOracleValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OracleDataReader
的用法示例。
在下文中一共展示了OracleDataReader.GetOracleValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildValueArray
private static object[] BuildValueArray(OracleDataReader reader, IList<string> fieldTypes, bool prefetch)
{
var columnData = new object[fieldTypes.Count];
for (var i = 0; i < fieldTypes.Count; i++)
{
var fieldType = fieldTypes[i];
object value;
switch (fieldType)
{
case "BFile":
value = new OracleExternalBinaryFile(reader.GetOracleBFile(i));
break;
case "Blob":
value = new OracleBlobValue(reader.GetOracleBlob(i));
break;
case "Clob":
case "NClob":
value = new OracleClobValue(fieldType.ToUpperInvariant(), reader.GetOracleClob(i));
break;
case "Long":
var oracleString = reader.GetOracleString(i);
var stringValue = oracleString.IsNull
? (object)DBNull.Value
: $"{oracleString.Value}{(oracleString.Value.Length == OracleDatabaseModel.InitialLongFetchSize ? CellValueConverter.Ellipsis : null)}";
value = new OracleSimpleValue(stringValue);
break;
case "Raw":
value = new OracleRawValue(reader.GetOracleBinary(i));
break;
case "LongRaw":
value = new OracleLongRawValue(reader.GetOracleBinary(i));
break;
case "TimeStamp":
value = new OracleTimestamp(reader.GetOracleTimeStamp(i));
break;
case "TimeStampTZ":
value = new OracleTimestampWithTimeZone(reader.GetOracleTimeStampTZ(i));
break;
case "TimeStampLTZ":
value = new OracleTimestampWithLocalTimeZone(reader.GetOracleTimeStampLTZ(i));
break;
case "Decimal":
value = new OracleNumber(reader.GetOracleDecimal(i));
break;
#if !ORACLE_MANAGED_DATA_ACCESS_CLIENT
case "XmlType":
value = new OracleXmlValue(reader.GetOracleXmlType(i));
break;
#endif
case "Object":
case "Array":
value = reader.GetOracleValue(i);
break;
case "Date":
var oracleDate = reader.GetOracleDate(i);
value = oracleDate.IsNull
? new OracleDateTime()
: new OracleDateTime(oracleDate);
break;
case "IntervalDS":
value = new OracleIntervalDayToSecond(reader.GetOracleIntervalDS(i));
break;
case "IntervalYM":
value = new OracleIntervalYearToMonth(reader.GetOracleIntervalYM(i));
break;
case "Char":
case "NChar":
case "Varchar":
case "Varchar2":
case "NVarchar":
case "NVarchar2":
value = new OracleSimpleValue(reader.GetValue(i));
break;
case OracleRowId.TypeName:
value = new OracleRowId(reader.GetOracleString(i));
break;
default:
value = reader.GetValue(i);
break;
}
if (prefetch)
{
var largeValue = value as ILargeValue;
largeValue?.Prefetch();
}
columnData[i] = value;
}
return columnData;
}