wizards/source/access2base/Control.xba  |   22 +++++-----------------
 wizards/source/access2base/Database.xba |   17 ++++++++++++++---
 2 files changed, 19 insertions(+), 20 deletions(-)

New commits:
commit 3e39524d4171f0ecadad5658d6e03cf44126b2a0
Author:     Jean-Pierre Ledure <j...@ledure.be>
AuthorDate: Thu Jul 19 18:55:59 2018 +0200
Commit:     Jean-Pierre Ledure <j...@ledure.be>
CommitDate: Thu Jul 19 19:02:30 2018 +0200

    Access2Base - tdf#118767 Fix DLookup for Firebird
    
    Firebird requires
       SELECT FIRST 1 ...
    syntax, while HSQLDB and other RDBMS use
       SELECT TOP 1
    
    Additionally the Value property for monoselect listboxes has been reworked

diff --git a/wizards/source/access2base/Control.xba 
b/wizards/source/access2base/Control.xba
index d1a2a8292cbd..3a41609ef48e 100644
--- a/wizards/source/access2base/Control.xba
+++ b/wizards/source/access2base/Control.xba
@@ -1800,26 +1800,14 @@ Dim oControlEvents As Object, sEventName As String
                                                                        End If
                                                                End If
                                                        Case Else
-                                                               vCurrentValue = 
ControlModel.getCurrentValue()          &apos;  Space or uninitialized array if 
no selection at all
-                                                               If 
IsArray(vCurrentValue) Then                                          &apos;  Is 
an array if MultiSelect
-                                                                       If 
UBound(vCurrentValue) &gt;= LBound(vCurrentValue) Then
-                                                                               
vListboxValue = vCurrentValue(0)
-                                                                       Else
-                                                                               
vListboxValue = &quot;&quot;
-                                                                       End If
-                                                               Else
-                                                                       
vListboxValue = vCurrentValue
-                                                               End If
-                                                               lListIndex = -1 
                                &apos;  Speed up getting value PM PASTIM 
12/02/2013
-                                                               If 
vListboxValue &lt;&gt; &quot;&quot; Then
-                                                                       If 
Ubound(ControlModel.SelectedItems) &gt;= 0 Then lListIndex = 
Controlmodel.Selecteditems(0)
-                                                               End If
+                                                               
&apos;getCurrentValue does not return any significant value anymore
+                                                               &apos;  Speed 
up getting value PM PASTIM 12/02/2013
+                                                               If 
Ubound(ControlModel.SelectedItems) &gt;= 0 Then lListIndex = 
Controlmodel.Selecteditems(0) Else lListIndex = -1
                                                                &apos; If 
listbox has hidden column = real bound field, then explore ValueItemList
-                                                               bListboxBound = 
_ListboxBound()
-                                                               If 
bListboxBound Then
+                                                               If 
_ListboxBound() Then
                                                                        If 
lListIndex &gt; -1 Then vGet = ControlModel.ValueItemList(lListIndex)        
&apos;  PASTIM
                                                                Else
-                                                                       vGet = 
vListboxValue
+                                                                       If 
lListIndex &gt; -1 Then vGet = ControlModel.getItemText(lListIndex)
                                                                End If
                                                End Select
                                        End If
diff --git a/wizards/source/access2base/Database.xba 
b/wizards/source/access2base/Database.xba
index 3e94c151b626..3bd3bced482b 100644
--- a/wizards/source/access2base/Database.xba
+++ b/wizards/source/access2base/Database.xba
@@ -1135,6 +1135,7 @@ Dim sExpr As String                               
&apos;For inclusion of aggregate function
 Dim sTempField As String               &apos;Random temporary field in SQL 
expression
 
 Dim sTarget as String, sWhere As String, sOrderBy As String, sLimit As String
+Dim sProductName As String
 
     vResult = Null
 
@@ -1144,7 +1145,14 @@ Dim sTarget as String, sWhere As String, sOrderBy As 
String, sLimit As String
        If pvOrderClause &lt;&gt; &quot;&quot; Then sOrderBy = &quot; ORDER BY 
&quot; &amp; pvOrderClause Else sOrderBy = &quot;&quot;
        sLimit = &quot;&quot;
 
-       Select Case UCase(MetaData.getDatabaseProductName())
+&apos; Workaround for 
https://bugs.documentfoundation.org/show_bug.cgi?id=118767
+&apos; awaiting solution for 
https://bugs.documentfoundation.org/show_bug.cgi?id=118809
+       sProductName = UCase(MetaData.getDatabaseProductName())
+       If sProductName = &quot;&quot; Then
+               If MetaData.URL = &quot;sdbc:embedded:firebird&quot; Or 
Left(MetaData.URL, 13) = &quot;sdbc:firebird&quot; Then sProductName = 
&quot;FIREBIRD&quot;
+       End If
+
+       Select Case sProductName
                Case &quot;MYSQL&quot;, &quot;SQLITE&quot;
                        If psFunction = &quot;&quot; Then
                                sTarget = psExpr
@@ -1153,6 +1161,9 @@ Dim sTarget as String, sWhere As String, sOrderBy As 
String, sLimit As String
                                sTarget = UCase(psFunction) &amp; &quot;(&quot; 
&amp; psExpr &amp; &quot;)&quot;
                        End If
                        sSql = &quot;SELECT &quot; &amp; sTarget &amp; &quot; 
AS &quot; &amp; sTempField &amp; &quot; FROM &quot; &amp; psDomain &amp;  
sWhere &amp; sOrderBy &amp; sLimit
+               Case &quot;FIREBIRD&quot;
+                       If psFunction = &quot;&quot; Then sTarget = &quot;FIRST 
1 &quot; &amp; psExpr Else sTarget = UCase(psFunction) &amp; &quot;(&quot; 
&amp; psExpr &amp; &quot;)&quot;
+                       sSql = &quot;SELECT &quot; &amp; sTarget &amp; &quot; 
AS &quot; &amp; sTempField &amp; &quot; FROM &quot; &amp; psDomain &amp; sWhere 
&amp; sOrderBy
                Case Else               &apos;  Standard syntax - Includes 
HSQLDB
                        If psFunction = &quot;&quot; Then sTarget = &quot;TOP 1 
&quot; &amp; psExpr Else sTarget = UCase(psFunction) &amp; &quot;(&quot; &amp; 
psExpr &amp; &quot;)&quot;
                        sSql = &quot;SELECT &quot; &amp; sTarget &amp; &quot; 
AS &quot; &amp; sTempField &amp; &quot; FROM &quot; &amp; psDomain &amp; sWhere 
&amp; sOrderBy
@@ -1167,8 +1178,8 @@ Dim sTarget as String, sWhere As String, sOrderBy As 
String, sLimit As String
            sSql = _ReplaceSquareBrackets(sSql)         &apos;Substitute [] by 
quote string
                Set oResult = .executeQuery(sSql)
            If Not IsNull(oResult) And Not IsEmpty(oResult) Then
-                               If Not oResult.next() Then Goto Exit_Function
-                           vResult = Utils._getResultSetColumnValue(oResult, 
1, True)          &apos;  Force return of binary field
+                       If Not oResult.next() Then Goto Exit_Function
+                       vResult = Utils._getResultSetColumnValue(oResult, 1, 
True)              &apos;  Force return of binary field
        End If
        End With
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to