Skip to main content



      Home
Home » Archived » BIRT » Use alias name instead of column name
Use alias name instead of column name [message #491811] Thu, 15 October 2009 18:51 Go to next message
Eclipse UserFriend
Hi,

This problem has been discussed in the following bug but I think it needs more attention:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=212387

Just to summarize the problem, if you defined query in the report that use alias for column names, it is possibly not working on the new JDBC drivers. The reason is, in newer JDBC drivers, like MySQL JConnector V5.1.5 and db2 4.x, the call to getColumnName will return the acutal database column name, not the alias name. BIRT is using this API to get the column name for binding.

There are a lot of problem using getColumnName, like the problem above, report not working across jdbc drivers. Also if you have a column named as "description" in two tables, and you want to get both in the same query, BIRT will add a suffix to the column name, and it is very unclear which is the one you want to bind. It also reduce the reusability of the query and dataset definition for similiar reports.

In the latest Java spec, getColumnLabel is described as: "
Gets the designated column's suggested title for use in printouts and displays. The suggested title is usually specified by the SQL AS clause. If a SQL AS is not specified, the value returned from getColumnLabel will be the same as the value returned by the getColumnName method. "

So this is exactly what we are expecting. Does BIRT has any plan to change the code to use getColumnLabel?

Thanks
Felix
Re: Use alias name instead of column name [message #491913 is a reply to message #491811] Fri, 16 October 2009 10:22 Go to previous messageGo to next message
Eclipse UserFriend
Felix,

Can you add your comments to the bug?

Jason

Felix Zhang wrote:
> Hi,
>
> This problem has been discussed in the following bug but I think it
> needs more attention:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=212387
>
> Just to summarize the problem, if you defined query in the report that
> use alias for column names, it is possibly not working on the new JDBC
> drivers. The reason is, in newer JDBC drivers, like MySQL JConnector
> V5.1.5 and db2 4.x, the call to getColumnName will return the acutal
> database column name, not the alias name. BIRT is using this API to get
> the column name for binding.
> There are a lot of problem using getColumnName, like the problem above,
> report not working across jdbc drivers. Also if you have a column named
> as "description" in two tables, and you want to get both in the same
> query, BIRT will add a suffix to the column name, and it is very unclear
> which is the one you want to bind. It also reduce the reusability of the
> query and dataset definition for similiar reports.
>
> In the latest Java spec, getColumnLabel is described as: "
> Gets the designated column's suggested title for use in printouts and
> displays. The suggested title is usually specified by the SQL AS
> clause. If a SQL AS is not specified, the value returned from
> getColumnLabel will be the same as the value returned by the
> getColumnName method. "
>
> So this is exactly what we are expecting. Does BIRT has any plan to
> change the code to use getColumnLabel?
>
> Thanks
> Felix
>
Re: Use alias name instead of column name [message #492007 is a reply to message #491913] Fri, 16 October 2009 20:46 Go to previous message
Eclipse UserFriend
Hi Jason,

I have copied my comment into this bug.

Our application need to be deployed on multiple database platforms, getColumnName will return db column name on some database, and return alias name on other databases. So we have to "cheat" the drivers to return the same name all the time, like instead of saying

select a.name aname, b.name bname
from...

we need to use something like

select a.name aname, b.name bname
from ...
union
select null aname, null bname
from dummytable
where 1=0

to make the jdbc driver not able to figure out the db column name and have to return the alias name. That's a real pain for us.

Thanks
Felix
Previous Topic:Report previewing OK then crashing on deploy
Next Topic:Problem opening report on Tomcat using php
Goto Forum:
  


Current Time: Wed Sep 24 09:44:53 EDT 2025

Powered by FUDForum. Page generated in 0.02876 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top