本文整理汇总了C#中OracleDataReader.GetOracleBlob方法的典型用法代码示例。如果您正苦于以下问题:C# OracleDataReader.GetOracleBlob方法的具体用法?C# OracleDataReader.GetOracleBlob怎么用?C# OracleDataReader.GetOracleBlob使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OracleDataReader
的用法示例。
在下文中一共展示了OracleDataReader.GetOracleBlob方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadFromDB
public static MessageInfo LoadFromDB(OracleDataReader reader)
{
var msg = new MessageInfo();
//npu, correlationNpu, businessid, creationdate, processid, interfacetoinvoke, operation, payload
msg.NPU = reader.GetString(0);
msg.CorrelationNPU = reader.IsDBNull(1) ? null : reader.GetString(1);
msg.BusinessId = reader.IsDBNull(2) ? null : reader.GetString(2);
msg.ReceivedDatetime = reader.IsDBNull(3) ? DateTime.Now : reader.GetDateTime(3);
msg.ProcessId = reader.IsDBNull(4) ? null : reader.GetString(4);
msg.InterfaceToInvoke = reader.IsDBNull(5) ? null : reader.GetString(5);
var oper = msg.NPU.Substring(4, 10);
msg.Operation = oper;
if (!string.IsNullOrEmpty(msg.CorrelationNPU))
oper = msg.CorrelationNPU.Substring(4, 10);
msg.Name = GetPrettyName(oper, null);
var blob = reader.GetOracleBlob(7);
var sb = new StringBuilder();
var buffer = new byte[1000];
while ((blob.Read(buffer, 0, buffer.Length)) > 0)
{
sb.Append(Encoding.UTF8.GetString(buffer));
Array.Clear(buffer, 0, buffer.Length);
}
msg.Payload = sb.ToString().Trim('\0');
return msg;
}
示例2: 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;
}