Issue 97096

Summary: Alias names in MySQL queries ignored in Base unless function applied in SQL
Product: Base Reporter: atpat <tony.patman>
Component: codeAssignee: marc.neumann
Status: CLOSED FIXED QA Contact: issues@dba <issues>
Severity: Trivial    
Priority: P3 CC: issues
Version: OOO300m9   
Target Milestone: OOo 3.3   
Hardware: PC   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 97765    

Description atpat 2008-12-10 12:54:38 UTC
N.B. I have selected "none" for the subcomponent field of this issue because I
do not know what the only other option "SRB", means.

Link a MySQL database to OO Base using JDBC (Sun).  Open a MySQL view (regarded
as a table by Base): aliases are ignored unless a function is used in the SQL
for that field.  This prevents systematic naming of query outputs in the context
of that query; e.g. may wish to have two "Name" fields from different tables and
to disambiguate them using aliases.

The aliases are always correctly shown in the "edit" view of the query in Base.
 They are only ignored when the query is executed and its output displayed.  The
behaviour is inherited when the db is used to do mail merge in OO Text.

Tests performed:
- queries dropped and recreated: no effect.
- CONCAT function applied: alias no longer ignored by Base.
Comment 1 brh 2009-01-12 10:51:07 UTC
I have a problem which I suspect has the same root cause as this one.
There was a tightening up of the mysql-connector behaviour as decribed here:

http://bugs.mysql.com/bug.php?id=40256

In my case the result of a query including aliases malfunctioned, producing wrong data in the wrong 
columns.

The work-around was to append:

   ?useOldAliasMetadataBehavior=true

to the name of the database in the 'Database Properties' dialog.

Please can you make the neccessary changes to the openoffice code.
Comment 2 caolanm 2009-09-18 20:26:17 UTC
I think from the reports we have at
https://bugzilla.redhat.com/show_bug.cgi?id=523879 that we can "confirm" this at
least.
Comment 3 Frank Schönheit 2009-09-30 13:11:33 UTC
fs->oj: Can reproduce this: Executing the query 
  SELECT `ID` AS `ID_V`, `name` AS `name_V` FROM `testdb`.`names`
gives me two columns named "ID" and "name", that is, the aliases are completely
ignored.

I don't think we should *always* append the "useOldAliasMetadataBehavior=true"
parameter to the connection URL. Finally, the change in Connector/J was made for
a reason ... I somehow doubt that the new behavior is "compliant", though
https://bugzilla.redhat.com/show_bug.cgi?id=523879 cites a piece of
documentation which claims this.
Anyway, I think we should introduce another driver setting which controls this
behavior, and is supported by our MySQL/JDBC driver only.
Comment 4 Frank Schönheit 2009-09-30 13:12:22 UTC
changing platform to "All"
Comment 5 ocke.janssen 2009-11-18 12:09:31 UTC
Fixed in cws dba33d.

No new setting necessary for MySQL
Comment 6 ocke.janssen 2009-12-18 09:17:29 UTC
Please verify. Thanks.
Comment 7 marc.neumann 2010-01-14 07:43:42 UTC
verified in CWS dba33d

find more information about this CWS, like when it is available in the master
builds, in EIS, the Environment Information System:
http://eis.services.openoffice.org/EIS2/cws.ShowCWS?Path=DEV300%2Fdba33d