[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:04:44 UTC 2018
https://bugs.documentfoundation.org/show_bug.cgi?id=116890
--- Comment #15 from Lionel Elie Mamane <lionel at mamane.lu> ---
(In reply to Gerhard Schaber from comment #14)
> getColumnName returns the original name according to the manual.
It does not make much sense to me, but it seems you are right. A very clear
source is
https://stackoverflow.com/questions/4271152/getcolumnlabel-vs-getcolumnname
That is how the MySQL C++ connector does it. However, it still keeps unique
column names by appending "1", "2", etc when the same column is taken twice.
E.g. "colName", then "colName1", "colName2", etc. It uses an empty name for the
first computed column, then "1", "2", etc.
The MySQL JDBC also returns the original name. Computed columns have the same
string (the alias) in getColumnName() and getColumnLabel(). It lets duplicate
names for different result columns, though. However,
recordset.columns.ElementNames has "1", "2", etc appended to
The MySQL ODBC driver always returns the *alias* name in both getColumnName()
and getColumnLabel(), with duplicates. recordset.columns.ElementNames has "1",
"2", etc appended for unicity. ODBC has the notion of column label (with
SQLColAttribute(..., SQL_DESC_LABEL,...)) and column "original" name (with
SQLColAttribute(..., SQL_DESC_NAME,...)), the LibreOffice SDBC<->ODBC driver
makes the difference, but the MySQL ODBC driver doesn't.
> Is guess this is the case for HSQLDB.
Well, no, it is not. Everything has the alias name. I tried (Tasks table from
wizard):
Sub Main
Dim DBDocUI as Object
on error resume next
DBDocUI = ThisDatabaseDocument.currentController
if not DBDocUI.isConnected then
DBDocUI.connect
end if
dim s as Object
s = DBDocUI.ActiveConnection.createStatement()
dim r as Object
rs = s.executeQuery("SELECT ""TaskID"" AS ""TID1"", ""TaskID"" AS
""TID2"" FROM ""Tasks""")
MsgBox rs.metadata.getColumnName(1)
MsgBox rs.metadata.getColumnLabel(1)
XRay rs.columns.ElementNames
End Sub
--
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/26def27f/attachment.html>
More information about the Libreoffice-bugs
mailing list