summaryrefslogtreecommitdiff
path: root/wizards/source/access2base/Database.xba
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2018-07-19 18:55:59 +0200
committerJean-Pierre Ledure <jp@ledure.be>2018-07-19 19:02:30 +0200
commit3e39524d4171f0ecadad5658d6e03cf44126b2a0 (patch)
tree7b1cbc04508591cbc292221627690700fe040d17 /wizards/source/access2base/Database.xba
parent7175dd320bda267366350c3cd26ffabfd3fb284d (diff)
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
Diffstat (limited to 'wizards/source/access2base/Database.xba')
-rw-r--r--wizards/source/access2base/Database.xba17
1 files changed, 14 insertions, 3 deletions
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