<commit_before>USING XSharp.RDD.Support
USING XSharp.RDD.Enums
USING System.Reflection
USING System.Diagnostics


BEGIN NAMESPACE XSharp.RDD

    /// <summary>This class can be used to wrap an existing RDD and add some functionality to it, such as
    /// logging, encryption etc. <br/>
    /// To use it, create a subclass of this class and implement the methods that you want to override.<br/>
    /// The constructor of this class takes an existing RDD object and automatically replaces it in the
    /// Workarea table.
    /// </summary>
    /// <example>
    /// <code language="X#">
    /// CLASS MyRDD Inherit XSharp.RDD.WrapperRDD
    /// 
    /// CONSTRUCTOR(oRdd as XSharp.RDD.IRDD)
    ///    SUPER(oRdd)
    /// 
    /// METHOD GetValue(nFldPos AS LONG)		AS OBJECT
    ///    Log("Reading field "+nFldPos:ToString())
    ///    RETURN SUPER:GetValue(nFldPos)
    ///
    /// METHOD PutValue(nFldPos AS LONG, oValue AS OBJECT) AS LOGIC
    ///    Log("Writing field "+nFldPos:ToString()+" value "+oValue:ToString())
    ///    RETURN SUPER:PutValue(nFldPos, oValue)
    /// END CLASS
    /// 
    /// FUNCTION Start() AS VOID
    ///    // Open customer table
    ///    USE Customer NEW
    /// 
    ///    // Get current RDD for the selected Workarea
    ///    VAR oRdd := XSharp.RuntimeState.Workareas:GetRDD(Select())
    /// 
    ///    // Create Wrapper RDD. This automatically replaces the RDD in the Workarea table
    ///    oRdd := MyRDD{oRdd}
    /// 
    ///    ? FieldGet(1)           // This should also call Log() to show reading the value
    ///    ? FieldPut(1,"Jones")   // This should also call Log() to show writing the value
    ///    DbCloseArea()
    ///    RETURN
    /// 
    /// Function Log(cMessage as STRING) AS VOID
    ///    ? cMessage
    ///    RETURN
    /// </code>
    /// </example>
    [DebuggerDisplay("{DebuggerDisplay(),nq}")];
    CLASS WrapperRDD IMPLEMENTS IRdd
        // Install this as follows:
        // The class itself will take care of replacing the RDD in the Workarea table
        //
        // VAR oRdd := XSharp.RuntimeState.Workareas:GetRDD(<area Number>)      
        // oRdd := WrapperRDD{oRdd}
        // If you are only interested in certain methods, then subclass this class and only write the methods that you are interested in
        // 

        PROTECT oRdd AS IRdd

        PRIVATE METHOD DebuggerDisplay() AS STRING
            IF oRdd != NULL
                RETURN oRdd:Driver+" ("+oRdd:Alias+") - Wrapped"
            ENDIF
            RETURN "(uninitialized)"

        CONSTRUCTOR(loRdd AS IRdd)
            LOCAL oType AS System.Type
            LOCAL oFI   AS System.Reflection.FieldInfo
            LOCAL aRDDs AS IRdd[]
            oRdd    := loRdd
            oType   := TypeOf(XSharp.RDD.Workareas)
            oFI     := oType:GetField("RDDs",BindingFlags.NonPublic | BindingFlags.IgnoreCase|BindingFlags.Instance)
            aRDDs   := (IRdd[]) oFI:GetValue(XSharp.RuntimeState.Workareas)
            aRDDs[oRdd:Area] := SELF
            RETURN
            
            
        //-------------------------------------------------------
        // Record Movement
        //-------------------------------------------------------
        #region Record Movement
        /// <inheritdoc />			
        METHOD DbEval(info AS DbEvalInfo)		AS LOGIC
            RETURN oRdd:DbEval(info)        
            
        /// <inheritdoc />			
        METHOD GoTop()							AS LOGIC
            RETURN oRdd:GoTop()
            
        /// <inheritdoc />			
        METHOD GoBottom()						AS LOGIC   
            RETURN oRdd:GoBottom()
        /// <inheritdoc />			
        METHOD GoTo(nRec AS LONG)				AS LOGIC
            RETURN oRdd:GoTo(nRec)
            
        /// <inheritdoc />			
        METHOD GoToId(oRec AS OBJECT)			AS LOGIC
            RETURN oRdd:GoToId(oRec)
            
        /// <inheritdoc />			
        METHOD Skip(nToSkip AS INT)				AS LOGIC
            RETURN oRdd:Skip(nToSkip)
            
        /// <inheritdoc />			
        METHOD SkipFilter(nToSkip AS INT)		AS LOGIC
            RETURN oRdd:SkipFilter(nToSkip)
            
        /// <inheritdoc />			
        METHOD SkipRaw(nToSkip AS INT)			AS LOGIC 
            RETURN oRdd:SkipRaw(nToSkip)
            
        /// <inheritdoc />			
        METHOD SkipScope(nToSkip AS INT)		AS LOGIC
            RETURN oRdd:SkipScope(nToSkip)
        #endregion
        
        //-------------------------------------------------------
        // Read / Write
        //-------------------------------------------------------
        #region Read / Write
        /// <inheritdoc />			
        METHOD Append(lReleaseLock AS LOGIC)	AS LOGIC
            RETURN oRdd:Append(lReleaseLock)
            
        /// <inheritdoc />			
        METHOD Delete()							AS LOGIC   
            RETURN oRdd:Delete()
            
        /// <inheritdoc />			
        METHOD GetRec()							AS BYTE[]  
            RETURN oRdd:GetRec()
            
        /// <inheritdoc />			
        METHOD Pack()							AS LOGIC
            RETURN oRdd:Pack()
            
        /// <inheritdoc />			
        METHOD PutRec(aRec AS BYTE[])			AS LOGIC 
            RETURN oRdd:PutRec(aRec)
            
        /// <inheritdoc />			
        METHOD Recall()							AS LOGIC
            RETURN oRdd:Recall()
            
        /// <inheritdoc />			
        METHOD Zap()							AS LOGIC   
            RETURN oRdd:Zap()
            
        /// <inheritdoc />			
        METHOD Close() 							AS LOGIC
            RETURN oRdd:Close()
            
        /// <inheritdoc />			
        METHOD Create(info AS DbOpenInfo)		AS LOGIC  
            RETURN oRdd:Create(info)
            
        /// <inheritdoc />			
        METHOD Open(info AS DbOpenInfo)			AS LOGIC
            RETURN oRdd:Zap()

        #endregion
        //-------------------------------------------------------
        // Record Selection - Scoping
        //-------------------------------------------------------
        #region Record Selection - Scoping
        /// <inheritdoc />			<commit_msg>[Runtime] Fixed an error in WrapperRDD:Open()<commit_after>USING XSharp.RDD.Support
USING XSharp.RDD.Enums
USING System.Reflection
USING System.Diagnostics


BEGIN NAMESPACE XSharp.RDD

    /// <summary>This class can be used to wrap an existing RDD and add some functionality to it, such as
    /// logging, encryption etc. <br/>
    /// To use it, create a subclass of this class and implement the methods that you want to override.<br/>
    /// The constructor of this class takes an existing RDD object and automatically replaces it in the
    /// Workarea table.
    /// </summary>
    /// <example>
    /// <code language="X#">
    /// CLASS MyRDD Inherit XSharp.RDD.WrapperRDD
    /// 
    /// CONSTRUCTOR(oRdd as XSharp.RDD.IRDD)
    ///    SUPER(oRdd)
    /// 
    /// METHOD GetValue(nFldPos AS LONG)		AS OBJECT
    ///    Log("Reading field "+nFldPos:ToString())
    ///    RETURN SUPER:GetValue(nFldPos)
    ///
    /// METHOD PutValue(nFldPos AS LONG, oValue AS OBJECT) AS LOGIC
    ///    Log("Writing field "+nFldPos:ToString()+" value "+oValue:ToString())
    ///    RETURN SUPER:PutValue(nFldPos, oValue)
    /// END CLASS
    /// 
    /// FUNCTION Start() AS VOID
    ///    // Open customer table
    ///    USE Customer NEW
    /// 
    ///    // Get current RDD for the selected Workarea
    ///    VAR oRdd := XSharp.RuntimeState.Workareas:GetRDD(Select())
    /// 
    ///    // Create Wrapper RDD. This automatically replaces the RDD in the Workarea table
    ///    oRdd := MyRDD{oRdd}
    /// 
    ///    ? FieldGet(1)           // This should also call Log() to show reading the value
    ///    ? FieldPut(1,"Jones")   // This should also call Log() to show writing the value
    ///    DbCloseArea()
    ///    RETURN
    /// 
    /// Function Log(cMessage as STRING) AS VOID
    ///    ? cMessage
    ///    RETURN
    /// </code>
    /// </example>
    [DebuggerDisplay("{DebuggerDisplay(),nq}")];
    CLASS WrapperRDD IMPLEMENTS IRdd
        // Install this as follows:
        // The class itself will take care of replacing the RDD in the Workarea table
        //
        // VAR oRdd := XSharp.RuntimeState.Workareas:GetRDD(<area Number>)      
        // oRdd := WrapperRDD{oRdd}
        // If you are only interested in certain methods, then subclass this class and only write the methods that you are interested in
        // 

        PROTECT oRdd AS IRdd

        PRIVATE METHOD DebuggerDisplay() AS STRING
            IF oRdd != NULL
                RETURN oRdd:Driver+" ("+oRdd:Alias+") - Wrapped"
            ENDIF
            RETURN "(uninitialized)"

        CONSTRUCTOR(loRdd AS IRdd)
            LOCAL oType AS System.Type
            LOCAL oFI   AS System.Reflection.FieldInfo
            LOCAL aRDDs AS IRdd[]
            oRdd    := loRdd
            oType   := TypeOf(XSharp.RDD.Workareas)
            oFI     := oType:GetField("RDDs",BindingFlags.NonPublic | BindingFlags.IgnoreCase|BindingFlags.Instance)
            aRDDs   := (IRdd[]) oFI:GetValue(XSharp.RuntimeState.Workareas)
            aRDDs[oRdd:Area] := SELF
            RETURN
            
            
        //-------------------------------------------------------
        // Record Movement
        //-------------------------------------------------------
        #region Record Movement
        /// <inheritdoc />			
        METHOD DbEval(info AS DbEvalInfo)		AS LOGIC
            RETURN oRdd:DbEval(info)        
            
        /// <inheritdoc />			
        METHOD GoTop()							AS LOGIC
            RETURN oRdd:GoTop()
            
        /// <inheritdoc />			
        METHOD GoBottom()						AS LOGIC   
            RETURN oRdd:GoBottom()
        /// <inheritdoc />			
        METHOD GoTo(nRec AS LONG)				AS LOGIC
            RETURN oRdd:GoTo(nRec)
            
        /// <inheritdoc />			
        METHOD GoToId(oRec AS OBJECT)			AS LOGIC
            RETURN oRdd:GoToId(oRec)
            
        /// <inheritdoc />			
        METHOD Skip(nToSkip AS INT)				AS LOGIC
            RETURN oRdd:Skip(nToSkip)
            
        /// <inheritdoc />			
        METHOD SkipFilter(nToSkip AS INT)		AS LOGIC
            RETURN oRdd:SkipFilter(nToSkip)
            
        /// <inheritdoc />			
        METHOD SkipRaw(nToSkip AS INT)			AS LOGIC 
            RETURN oRdd:SkipRaw(nToSkip)
            
        /// <inheritdoc />			
        METHOD SkipScope(nToSkip AS INT)		AS LOGIC
            RETURN oRdd:SkipScope(nToSkip)
        #endregion
        
        //-------------------------------------------------------
        // Read / Write
        //-------------------------------------------------------
        #region Read / Write
        /// <inheritdoc />			
        METHOD Append(lReleaseLock AS LOGIC)	AS LOGIC
            RETURN oRdd:Append(lReleaseLock)
            
        /// <inheritdoc />			
        METHOD Delete()							AS LOGIC   
            RETURN oRdd:Delete()
            
        /// <inheritdoc />			
        METHOD GetRec()							AS BYTE[]  
            RETURN oRdd:GetRec()
            
        /// <inheritdoc />			
        METHOD Pack()							AS LOGIC
            RETURN oRdd:Pack()
            
        /// <inheritdoc />			
        METHOD PutRec(aRec AS BYTE[])			AS LOGIC 
            RETURN oRdd:PutRec(aRec)
            
        /// <inheritdoc />			
        METHOD Recall()							AS LOGIC
            RETURN oRdd:Recall()
            
        /// <inheritdoc />			
        METHOD Zap()							AS LOGIC   
            RETURN oRdd:Zap()
            
        /// <inheritdoc />			
        METHOD Close() 							AS LOGIC
            RETURN oRdd:Close()
            
        /// <inheritdoc />			
        METHOD Create(info AS DbOpenInfo)		AS LOGIC  
            RETURN oRdd:Create(info)
            
        /// <inheritdoc />			
        METHOD Open(info AS DbOpenInfo)			AS LOGIC
            RETURN oRdd:Open(info)

        #endregion
        //-------------------------------------------------------
        // Record Selection - Scoping
        //-------------------------------------------------------
        #region Record Selection - Scoping
        /// <inheritdoc />			
{'fraction_non_alphanumeric': 0.15334914533409666, 'fraction_numerical': 0.0003271448433794062, 'mean_word_length': 1.222464558342421, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7471491', 'n_tokens_mistral': 3788, 'n_tokens_neox': 3370, 'n_words': 909}