internal static OracleString GetPersistedRowid(OracleConnection connection, OciRowidDescriptor rowidHandle)
 {
     OracleString @null = OracleString.Null;
     if (rowidHandle != null)
     {
         OciErrorHandle errorHandle = connection.ErrorHandle;
         NativeBuffer scratchBuffer = connection.GetScratchBuffer(0xf82);
         bool success = false;
         bool flag = false;
         RuntimeHelpers.PrepareConstrainedRegions();
         try
         {
             int num;
             scratchBuffer.DangerousAddRef(ref success);
             if (OCI.ClientVersionAtLeastOracle9i)
             {
                 int length = scratchBuffer.Length;
                 num = TracedNativeMethods.OCIRowidToChar(rowidHandle, scratchBuffer, ref length, errorHandle);
                 if (num != 0)
                 {
                     connection.CheckError(errorHandle, num);
                 }
                 return new OracleString(scratchBuffer.PtrToStringAnsi(0, length));
             }
             rowidHandle.DangerousAddRef(ref flag);
             OciServiceContextHandle serviceContextHandle = connection.ServiceContextHandle;
             OciStatementHandle stmtp = new OciStatementHandle(serviceContextHandle);
             string stmt = "begin :rowid := :rdesc; end;";
             int offset = 0;
             int num6 = 4;
             int num5 = 8;
             int num3 = 12;
             int num2 = 0x10;
             int num4 = 20;
             try
             {
                 IntPtr ptr;
                 IntPtr ptr2;
                 num = TracedNativeMethods.OCIStmtPrepare(stmtp, errorHandle, stmt, OCI.SYNTAX.OCI_NTV_SYNTAX, OCI.MODE.OCI_DEFAULT, connection);
                 if (num != 0)
                 {
                     connection.CheckError(errorHandle, num);
                 }
                 scratchBuffer.WriteIntPtr(num5, rowidHandle.DangerousGetHandle());
                 scratchBuffer.WriteInt32(offset, 0);
                 scratchBuffer.WriteInt32(num6, 4);
                 scratchBuffer.WriteInt32(num3, 0);
                 scratchBuffer.WriteInt32(num2, 0xf6e);
                 num = TracedNativeMethods.OCIBindByName(stmtp, out ptr2, errorHandle, "rowid", 5, scratchBuffer.DangerousGetDataPtr(num4), 0xf6e, OCI.DATATYPE.VARCHAR2, scratchBuffer.DangerousGetDataPtr(num3), scratchBuffer.DangerousGetDataPtr(num2), OCI.MODE.OCI_DEFAULT);
                 if (num != 0)
                 {
                     connection.CheckError(errorHandle, num);
                 }
                 num = TracedNativeMethods.OCIBindByName(stmtp, out ptr, errorHandle, "rdesc", 5, scratchBuffer.DangerousGetDataPtr(num5), 4, OCI.DATATYPE.ROWID_DESC, scratchBuffer.DangerousGetDataPtr(offset), scratchBuffer.DangerousGetDataPtr(num6), OCI.MODE.OCI_DEFAULT);
                 if (num != 0)
                 {
                     connection.CheckError(errorHandle, num);
                 }
                 num = TracedNativeMethods.OCIStmtExecute(serviceContextHandle, stmtp, errorHandle, 1, OCI.MODE.OCI_DEFAULT);
                 if (num != 0)
                 {
                     connection.CheckError(errorHandle, num);
                 }
                 if (scratchBuffer.ReadInt16(num3) == -1)
                 {
                     return @null;
                 }
                 @null = new OracleString(scratchBuffer, num4, num2, MetaType.GetMetaTypeForType(OracleType.RowId), connection, false, true);
                 GC.KeepAlive(rowidHandle);
             }
             finally
             {
                 OciHandle.SafeDispose(ref stmtp);
             }
         }
         finally
         {
             if (flag)
             {
                 rowidHandle.DangerousRelease();
             }
             if (success)
             {
                 scratchBuffer.DangerousRelease();
             }
         }
     }
     return @null;
 }
        internal static OracleString GetPersistedRowid(OracleConnection connection, OciRowidDescriptor rowidHandle)
        {
            OracleString @null = OracleString.Null;

            if (rowidHandle != null)
            {
                OciErrorHandle errorHandle   = connection.ErrorHandle;
                NativeBuffer   scratchBuffer = connection.GetScratchBuffer(0xf82);
                bool           success       = false;
                bool           flag          = false;
                RuntimeHelpers.PrepareConstrainedRegions();
                try
                {
                    int num;
                    scratchBuffer.DangerousAddRef(ref success);
                    if (OCI.ClientVersionAtLeastOracle9i)
                    {
                        int length = scratchBuffer.Length;
                        num = TracedNativeMethods.OCIRowidToChar(rowidHandle, scratchBuffer, ref length, errorHandle);
                        if (num != 0)
                        {
                            connection.CheckError(errorHandle, num);
                        }
                        return(new OracleString(scratchBuffer.PtrToStringAnsi(0, length)));
                    }
                    rowidHandle.DangerousAddRef(ref flag);
                    OciServiceContextHandle serviceContextHandle = connection.ServiceContextHandle;
                    OciStatementHandle      stmtp = new OciStatementHandle(serviceContextHandle);
                    string stmt   = "begin :rowid := :rdesc; end;";
                    int    offset = 0;
                    int    num6   = 4;
                    int    num5   = 8;
                    int    num3   = 12;
                    int    num2   = 0x10;
                    int    num4   = 20;
                    try
                    {
                        IntPtr ptr;
                        IntPtr ptr2;
                        num = TracedNativeMethods.OCIStmtPrepare(stmtp, errorHandle, stmt, OCI.SYNTAX.OCI_NTV_SYNTAX, OCI.MODE.OCI_DEFAULT, connection);
                        if (num != 0)
                        {
                            connection.CheckError(errorHandle, num);
                        }
                        scratchBuffer.WriteIntPtr(num5, rowidHandle.DangerousGetHandle());
                        scratchBuffer.WriteInt32(offset, 0);
                        scratchBuffer.WriteInt32(num6, 4);
                        scratchBuffer.WriteInt32(num3, 0);
                        scratchBuffer.WriteInt32(num2, 0xf6e);
                        num = TracedNativeMethods.OCIBindByName(stmtp, out ptr2, errorHandle, "rowid", 5, scratchBuffer.DangerousGetDataPtr(num4), 0xf6e, OCI.DATATYPE.VARCHAR2, scratchBuffer.DangerousGetDataPtr(num3), scratchBuffer.DangerousGetDataPtr(num2), OCI.MODE.OCI_DEFAULT);
                        if (num != 0)
                        {
                            connection.CheckError(errorHandle, num);
                        }
                        num = TracedNativeMethods.OCIBindByName(stmtp, out ptr, errorHandle, "rdesc", 5, scratchBuffer.DangerousGetDataPtr(num5), 4, OCI.DATATYPE.ROWID_DESC, scratchBuffer.DangerousGetDataPtr(offset), scratchBuffer.DangerousGetDataPtr(num6), OCI.MODE.OCI_DEFAULT);
                        if (num != 0)
                        {
                            connection.CheckError(errorHandle, num);
                        }
                        num = TracedNativeMethods.OCIStmtExecute(serviceContextHandle, stmtp, errorHandle, 1, OCI.MODE.OCI_DEFAULT);
                        if (num != 0)
                        {
                            connection.CheckError(errorHandle, num);
                        }
                        if (scratchBuffer.ReadInt16(num3) == -1)
                        {
                            return(@null);
                        }
                        @null = new OracleString(scratchBuffer, num4, num2, MetaType.GetMetaTypeForType(OracleType.RowId), connection, false, true);
                        GC.KeepAlive(rowidHandle);
                    }
                    finally
                    {
                        OciHandle.SafeDispose(ref stmtp);
                    }
                }
                finally
                {
                    if (flag)
                    {
                        rowidHandle.DangerousRelease();
                    }
                    if (success)
                    {
                        scratchBuffer.DangerousRelease();
                    }
                }
            }
            return(@null);
        }