[Libreoffice-bugs] [Bug 121342] Access2Base Counter for OpenRecordset usage is too low

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Mon Nov 12 16:58:48 UTC 2018


https://bugs.documentfoundation.org/show_bug.cgi?id=121342

Jean-Pierre Ledure <jp at ledure.be> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #9 from Jean-Pierre Ledure <jp at ledure.be> ---
Hi,

I reproduced the issue with a variant of the script in Comment 7:

Sub TestBug121342()
        Dim db As Object, rec As Object, k As Long 
        Set db = Application.CurrentDb()
        db.CloseAllRecordsets()
        k = 0
        Do
                k = k + 1
                If k Mod 100 = 0 Then DoCmd.SysCmd(acSysCmdSetStatus, "k = " &
k)
                Set rec = db.OpenRecordset("FACTURE")
                rec.mClose
        Loop 
        db.CloseAllRecordsets()
End Sub

Indeed the overflow is caused by the RecordsetMax variable which is an Integer
and is,as a consequence, limited to 32767. Additionally the variable is not
decremented when a recordset is closed, as should => This is a bug.

Replacing in the Database module of the Access2Base library the definition of
RecordsetMax by replacing Integer by Long
- is a workaround for the current issue,
- has NO ADDITIONAL SIDE EFFECTS.

I suggest you to bypass the issue in your own code by adding something like
                If k Mod 100 = 0 Then db.RecordsetMax = 1
in the above loop. (1 and not 0 to force CloseAllRecordsets to do something
even if the number of open recordsets in the same run is a multiple of 100
...).

I will prepare a patch on master to make RecordsetMax a Long type and to
include somewhere a decrement of its value.

JPL

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20181112/d66347db/attachment-0001.html>


More information about the Libreoffice-bugs mailing list