Bug 121424 - Error Access2Base setValue with Firebird
Summary: Error Access2Base setValue with Firebird
Status: RESOLVED DUPLICATE of bug 118680
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
(earliest affected) rc
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
Depends on:
Reported: 2018-11-14 17:11 UTC by tsultana
Modified: 2018-11-15 15:36 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:

Error Message (8.14 KB, image/png)
2018-11-14 17:12 UTC, tsultana
HSQLDB file that works correctly (4.73 KB, application/vnd.oasis.opendocument.database)
2018-11-14 17:12 UTC, tsultana
Firebird file that produces error (4.28 KB, application/vnd.oasis.opendocument.database)
2018-11-14 17:13 UTC, tsultana

Note You need to log in before you can comment on or make changes to this bug.
Description tsultana 2018-11-14 17:11:07 UTC
I originally posted this to https://forum.openoffice.org/en/forum/viewtopic.php?f=47&t=95590

Using the OpenRecordset to AddNew a character type field (char or varchar) will produce an error with Firebird. This has been tested on Debian Linux 4.9 with LO 6.1.3 and Win10 with LO 6.1.1 with the same results. Attached is a working HSQLDB and not working Firebird example with the same code.

Steps to Reproduce:
For the Firebird database the following code errors with the .Fields().Value line when it tries to setValue().
oRec = CurrentDb().OpenRecordset("char_pkey")
oRec.Fields("test").Value = "abcd"

I debugged the Access2Base code stepping into the following modules. Line 704 in _PropertySet() fails because _Precision is set to 0 so any length character field fails on error length. That is not the error reported on line 776 because the problem occurs earlier.

_Precision is a private variable in the module but is not set to a value anywhere and its only use is on line 704 below with the 0 initialization value. When I run the HSQLDB.odb example the _Precision variable has a value of 2147483647 (0x7FFFFFFF) so there may be a difference with initialization?

REM Access2Base:Field Module
17 Private _Precision As Long

127 Property Let Value(ByVal pvValue As Variant)
128 Call _PropertySet("Value", pvValue)
129 End Property ' Value (set)

623 Private Function _PropertySet(ByVal psProperty As String, ByVal pvValue As Variant) As Boolean

655 Case UCase("Value")

664 Select Case Column.Type

703 If Not Utils._CheckArgument(pvValue, iArgNr, vbString, , False) Then Goto Trace_Error_Value
704* If Len(pvValue) > _Precision Then Goto Trace_Error_Length
705 Column.updateString(pvValue) ' vbString

Watch Variables
_Precision = 0
pvValue = "abcd"
cstThisSub = "Field.setValue"
iArgNr = 1
psProperty = "Value"

Actual Results:
Error #12 variable not defined but the error actually occurs at line 704 in Access2Base Field module.

Expected Results:
The string length is acceptable and should be written to the table without error.

Reproducible: Always

User Profile Reset: No

OpenGL enabled: Yes

Additional Info:
Successfully write to table the same as the RunSQL below.

The CurrentDB().RunSQL() works for both HSQLDB and Firebird
CurrentDb().RunSQL("insert into ""char_pkey"" Values ( 'abcd' )")

Build ID: 1:6.1.3-1
CPU threads: 8; OS: Linux 4.9; UI render: default; VCL: gtk3; 
Locale: en-US (en_US.UTF-8); Calc: group threaded

Version: (x64)
Build ID: 5d19a1bfa650b796764388cd8b33a5af1f5baa1b
CPU threads: 4; OS: Windows 10.0; UI render: default; 
Locale: en-US (en_US); Calc: group threaded
Comment 1 tsultana 2018-11-14 17:12:12 UTC
Created attachment 146626 [details]
Error Message
Comment 2 tsultana 2018-11-14 17:12:47 UTC
Created attachment 146627 [details]
HSQLDB file that works correctly
Comment 3 tsultana 2018-11-14 17:13:19 UTC
Created attachment 146628 [details]
Firebird file that produces error
Comment 4 Drew Jensen 2018-11-14 17:41:20 UTC
Test with Ubuntu 18.04 and LibreOffice 6.2Alpha1

The library is not officially supported with Firebird until LibreOffice 6.2 is my understanding.

Using 6.2 the routine worked as expected with Firebird embedded file.
Comment 5 Drew Jensen 2018-11-14 17:48:00 UTC
Went back and checked and library code was checked into the 6.2 release adding Firebird support officially.

Setting this to NOTABUG because of the version number difference and add the developer to CC just in case I misunderstood the situation.
Comment 6 tsultana 2018-11-14 18:08:22 UTC
I just tested under Ubuntu 16.04 with LO 6.2alpha1 and confirmed the bug is fixed in that version.


Comment 7 Jean-Pierre Ledure 2018-11-15 15:36:41 UTC

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