Bug 136063 - access2base recordset-bug
Summary: access2base recordset-bug
Status: RESOLVED DUPLICATE of bug 136143
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
7.0.0.3 release
Hardware: All macOS (All)
: medium normal
Assignee: Jean-Pierre Ledure
URL:
Whiteboard: target:7.1.0
Keywords:
Depends on: 136143
Blocks:
  Show dependency treegraph
 
Reported: 2020-08-24 08:19 UTC by Helmut Seidel M.A.
Modified: 2021-12-21 19:18 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Database-File with Access2Base Code (4.40 KB, application/vnd.oasis.opendocument.database)
2020-08-24 11:52 UTC, Helmut Seidel M.A.
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Helmut Seidel M.A. 2020-08-24 08:19:59 UTC
Description:
In LO 7.0 on MacOs and Linux using an embedded firebird database it ist not possible to access any method of the recordset-fields-object in LO Basic. The following code produces an error in LO 7.0 but works with LO 6.4.6:

Dim objRec As Object
Dim objCon As Object
Dim objField As Object

If GlobalScope.BasicLibraries.hasByName("Access2Base") Then
    GlobalScope.BasicLibraries.loadLibrary("Access2Base")
End If
Call Application.OpenConnection(ThisDatabaseDocument)


Set objCon = Application.CurrentDb()
Set objRec = objCon.OpenRecordset("SELECT * FROM KONTAKTE")
Dim intCount As Long

intCount = 0

While Not objRec.EOF
    intCount = intCount + 1
    ' The following Line produces the error-message given below:
    ' Dim objRec As Object
Dim objCon As Object
Dim objField As Object

If GlobalScope.BasicLibraries.hasByName("Access2Base") Then
    GlobalScope.BasicLibraries.loadLibrary("Access2Base")
End If
Call Application.OpenConnection(ThisDatabaseDocument)


Set objCon = Application.CurrentDb()
Set objRec = objCon.OpenRecordset("SELECT * FROM KONTAKTE")
Dim intCount As Long

intCount = 0

While Not objRec.EOF
    intCount = intCount + 1
    ' Die folgende Zeile verursacht den Fehler:
    ' Error #13 (Datentypen unverträglich) aufgetreten in Zeile 407 in Field.getValue
    msgBox objRec.Fields("NAME1").Value
    objRec.MoveNext()
Wend
objRec.MoveFirst()
    msgBox objRec.Fields("NAME1").Value
    objRec.MoveNext()
Wend
objRec.MoveFirst()

Steps to Reproduce:
1.Just use any firebird database and execute the given code
2.
3.

Actual Results:
Error-Message: "Error #13 (Datentypen unverträglich) aufgetreten in Zeile 407 in Field.getValue" produced - the same is for any method of the fields-Object

Expected Results:
The basic code-crashes


Reproducible: Always


User Profile Reset: No



Additional Info:
printed out the field values
Comment 1 Julien Nabet 2020-08-24 08:36:44 UTC
I may be wrong but Access2Base concerns MS Access database, it's not a lib to access any database, in your case a Firebird database.

Jean-Pierre: any thoughts here?
Comment 2 Helmut Seidel M.A. 2020-08-24 09:36:29 UTC
Yes, in this case you are wrong. Access2Base adds a Layer around Uno-Api to access any Database in an Ms-Access like manner. I use it for one reason, In A2B you can use MoveNext and MoveLast Methods, in a way with Firebird-Databses which present a bug in Uno...
Comment 3 Julien Nabet 2020-08-24 09:48:31 UTC
Would it be possible you provide a minimum embedded Firebird database file with the macro so it could be quickly reproduced?
Of course, don't forget to sanitize it (see https://wiki.documentfoundation.org/QA/Bugzilla/Sanitizing_Files_Before_Submission)
Comment 4 Helmut Seidel M.A. 2020-08-24 11:52:41 UTC
Created attachment 164632 [details]
Database-File with Access2Base Code

To start the app run Sub Main in Module A2B of the attacheched odd-File

The code works in LO 6.4.6 but produces an Error-Message in LO 7.0
Comment 5 Commit Notification 2020-08-24 16:14:50 UTC
Jean-Pierre Ledure committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/fcb2b4695fdc7f5c9915a176762cfcbafe96e945

Access2Base - tdf#136063 Workaround Basic missing argument handling

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Jean-Pierre Ledure 2020-08-24 16:25:49 UTC
I implemented a patch as a workaround for a different behaviour of the Basic interpreter between 6.4 and 7.0. I don't know yet if it is a bug or a feature.

Read my comment in the commit:

When an argument is missing in a call to a Basic function
the IsMissing() function applied on the argument
should respond True.
However sometimes(?) the argument contains instead "Error 448"
making IsMissing responding False.

This commit puts an explicit argument in the function call
avoiding the different behaviour of the Basic interpreter
in LO 7.0 vs. previous releases.

Error 448 = "Named argument not found"

This patch solves the issue at least in my Linux/LO 7.0 environment.

Thanks for having reported the issue.
Comment 7 Andreas Heinisch 2020-08-24 17:52:29 UTC
It could be somehow related to https://gerrit.libreoffice.org/c/core/+/90215, but I am not sure.
Comment 8 Andreas Heinisch 2020-08-24 18:10:19 UTC
More likely to https://gerrit.libreoffice.org/c/core/+/87550
Comment 9 Commit Notification 2020-08-26 14:11:53 UTC
Jean-Pierre Ledure committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/57666b8ba70f27c7250ef32f4cb9e7660e258521

Access2Base - tdf#136063 Workaround Basic missing argument handling (2)

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Mike Kaganski 2020-08-26 15:21:06 UTC
Thank you Jean-Pierre Ledure! However, I suppose it's incorrect to workaround bugs like this. We should simply fix tdf#136143 (that unfortunately only was filed lately; the solution is already being discussed in the gerrit change that had introduced the problem - see comment 8), and avoid constructs like in the committed patches, that will become burden to support...
Comment 11 Jean-Pierre Ledure 2020-08-26 16:46:59 UTC
Mike, I can only agree with you !!

Fair enough but, in the meantime, the Access2Base library is broken for 7.0 users, while the identification of the root cause was not obvious. Hence the 136143 bug report. Additionally, the correction of bug#136143 is out of my competence ...

If such a correction can be introduced soon for 7.0, I will revert my changes on master.
Comment 12 Helmut Seidel M.A. 2020-09-11 14:44:59 UTC
Hello again,
just tested the code with LO 7.0.1 - the error still present, so do users have to wait until 7.1 some time in next year? Or will the fix be included in an earlier release.
Thanks
Comment 13 Jean-Pierre Ledure 2020-09-11 14:57:00 UTC
The resolution of tdf#136143 solves the current issue.
It will be available in LO 7.0.2, which, according to https://wiki.documentfoundation.org/ReleasePlan/7.0#7.0.2_release, is announced for the week of Oct 5, 2020.

That patch makes the correction introduced in 7.1 unnecessary.
Comment 14 Helmut Seidel M.A. 2020-09-11 15:00:09 UTC
Hello again,

I've just reread my comment. It was neither meant to sound unfriendly nor demanding.
Apologies
Comment 15 Jean-Pierre Ledure 2020-09-11 15:07:13 UTC
No problem. Your question was relevant, anyway.

*** This bug has been marked as a duplicate of bug 136143 ***