internal static int GetBytes(NativeBuffer buffer, int valueOffset, MetaType metaType, int sourceOffset, byte[] destinationBuffer, int destinationOffset, int byteCount) { if (!metaType.IsLong) { buffer.ReadBytes(valueOffset + sourceOffset, destinationBuffer, destinationOffset, byteCount); return(byteCount); } NativeBuffer_LongColumnData.CopyOutOfLineBytes(buffer.ReadIntPtr(valueOffset), sourceOffset, destinationBuffer, destinationOffset, byteCount); return(byteCount); }
internal static string MarshalToString(NativeBuffer buffer, int valueOffset, int lengthOffset, MetaType metaType, OracleConnection connection, bool boundAsUCS2, bool outputParameterBinding) { string str; int length = GetLength(buffer, lengthOffset, metaType); if (boundAsUCS2 && outputParameterBinding) { length /= 2; } bool flag = metaType.IsLong && !outputParameterBinding; if (boundAsUCS2) { if (flag) { byte[] destinationBuffer = new byte[length * System.Data.Common.ADP.CharSize]; NativeBuffer_LongColumnData.CopyOutOfLineBytes(buffer.ReadIntPtr(valueOffset), 0, destinationBuffer, 0, length * System.Data.Common.ADP.CharSize); str = Encoding.Unicode.GetString(destinationBuffer); } else { str = buffer.PtrToStringUni(valueOffset, length); } } else { byte[] buffer2; if (flag) { buffer2 = new byte[length]; NativeBuffer_LongColumnData.CopyOutOfLineBytes(buffer.ReadIntPtr(valueOffset), 0, buffer2, 0, length); } else { buffer2 = buffer.ReadBytes(valueOffset, length); } str = connection.GetString(buffer2, metaType.UsesNationalCharacterSet); } GC.KeepAlive(buffer); return(str); }