[Libreoffice-bugs] [Bug 116890] Firebird: empty columns gone with prepared statement
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Tue Apr 10 14:53:35 UTC 2018
https://bugs.documentfoundation.org/show_bug.cgi?id=116890
--- Comment #17 from Lionel Elie Mamane <lionel at mamane.lu> ---
It still seems the problem with Firebird-in-Libreoffice preparedstatement is
that the columns collection is constructed with duplicate column names, which
means duplicates are dropped.
This could be a Firebird bug. Julien, could you please confirm that by tracing
the call to the Firebird API in both cases, and see that it is the Firebird API
that returns something different? Then we can file a firebird bug for that.
To be clear, the two cases are (in Gerhard's code):
oResult = oPrepStatement.executeQuery
ccols = oPrepStatement.Columns
and
oResult = oPrepStatement.executeQuery
ccols = oResult.Columns
In all cases, what you want to trace is
connectivity::firebird::OResultSetMetaData::getColumnName
It accesses
m_pSqlda->sqlvar[column-1].sqlname
If in one case, several columns have the same name "CONSTANT" and in the other
case all columns have unique names like "CONSTANT", "CONSTANT1", "CONSTANT2",
etc, then we have definitely found the problem, it is in Firebird.
For a simpler test than Gerhard's code, take his database, but execute this
basic code:
Sub Main
Dim DBDocUI as Object
on error resume next
DBDocUI = ThisDatabaseDocument.currentController
if not DBDocUI.isConnected then
DBDocUI.connect
end if
on error goto 0
dim s as Object
's = DBDocUI.ActiveConnection.createStatement()
s = DBDocUI.ActiveConnection.prepareStatement("SELECT ""ID"" AS
""TID1"", ""ID"" AS ""TID2"" FROM ""MitgliederVerband""")
dim r as Object
'rs = s.executeQuery("SELECT ""ID"" AS ""TID1"", ""ID"" AS ""TID2""
FROM ""MitgliederVerband""")
rs = s.executeQuery()
dim i as integer
for i=1 to rs.metadata.ColumnCount
MsgBox i & ": " & rs.metadata.getColumnName(i) & " " &
rs.metadata.getColumnLabel(i)
next i
XRay rs.columns.ElementNames
XRay rs.columns.getByName("ID")
XRay rs.columns.getByName("ID1")
End Sub
Using alternatively the two definitions of s and rs, which will be your two
cases.
Thanks in advance.
--
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/20180410/c01dda28/attachment-0001.html>
More information about the Libreoffice-bugs
mailing list