internal void GetAttribute(OCI.ATTR attribute, out string value, OciErrorHandle errorHandle, OracleConnection connection) { IntPtr zero = IntPtr.Zero; uint sizep = 0; int rc = TracedNativeMethods.OCIAttrGet(this, ref zero, ref sizep, attribute, errorHandle); if (rc != 0) { OracleException.Check(errorHandle, rc); } byte[] destination = new byte[sizep]; Marshal.Copy(zero, destination, 0, (int)sizep); value = connection.GetString(destination); }
internal void GetAttribute( OCI.ATTR attribute, out string value, OciHandle errorHandle, OracleConnection connection ) { IntPtr tempptr; int tempub4; int rc = TracedNativeMethods.OCIAttrGet(this, out tempptr, out tempub4, attribute, errorHandle); if (0 != rc) { OracleException.Check(errorHandle, rc); } value = connection.GetString(tempptr, tempub4, false); GC.KeepAlive(this); }
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); }
static internal string MarshalToString( NativeBuffer buffer, int valueOffset, int lengthOffset, MetaType metaType, OracleConnection connection, bool boundAsUCS2, bool outputParameterBinding ) { int valueLength = GetLength(buffer, lengthOffset, metaType); IntPtr valueBuffer = (IntPtr)buffer.PtrOffset(valueOffset); // Long values are bound out-of-line if (metaType.IsLong && !outputParameterBinding) { valueBuffer = (IntPtr)Marshal.ReadIntPtr(valueBuffer); } if (boundAsUCS2 && outputParameterBinding) { valueLength /= 2; } string result; if (boundAsUCS2) { result = Marshal.PtrToStringUni(valueBuffer, valueLength); } else { result = connection.GetString(valueBuffer, valueLength, metaType.UsesNationalCharacterSet); } GC.KeepAlive(buffer); return(result); }
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; }