Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 312877

Summary: Alias is not displayed when use 'select as' sql statement.[0702]
Product: z_Archived Reporter: Maggie Shen <lshen>
Component: BIRTAssignee: Wenjie Tu <wtu>
Status: VERIFIED WONTFIX QA Contact: Maggie Shen <lshen>
Severity: normal    
Priority: P3 CC: bluesoldier, lerby84, mwu
Version: 2.6.0   
Target Milestone: 2.6.1   
Hardware: PC   
OS: Windows XP   
Whiteboard: Obsolete
Attachments:
Description Flags
screen shot none

Description Maggie Shen CLA 2010-05-14 04:51:22 EDT
Created attachment 168513 [details]
screen shot

description:
When use 'select as' sql statement, the alias is not displayed in output column.

build id:
2.6.0 v20100514-0630

steps to reproduce:
1. New a data source from sample db.
2. New a data set using the query below:
select CLASSICMODELS.CUSTOMERS.CUSTOMERNUMBER as num
from CLASSICMODELS.CUSTOMERS
3. Switch to Output Columns page.

Expected result:
'num' should be displayed as alias. 

Actual result:
'num' is displayed as display name.See attached screen shot.
Comment 1 Wenjie Tu CLA 2010-07-27 22:29:27 EDT
BIRT is based on ODA which provides following APIs about result set columns metadata in org.eclipse.datatools.connectivity.oda.IResultSetMetaData:
    /**
     * Returns the name of the specific column.
     * @param index    column number (1-based).
     * @return        the column name.
     * @throws OdaException        if data source error occurs.
     */
    public String getColumnName( int index ) throws OdaException;

    /**
     * Returns the designated column's suggested title for use
     * in the column heading and/or display name.
     * @param index column number (1-based).
     * @return        the column's suggested title.
     * @throws OdaException        if data source error occurs.
     */
    public String getColumnLabel( int index ) throws OdaException;

BIRT takes the getColumnName(index) return value as the "Name" of data set column and the getColumnLabel(index) return value as the "Display Name" of data set column.

In this case, both getColumnName and getColumnLabel return "NUM". that's why "Name" and "Display Name" of data set column are displaying "NUM".

"Alias" of data set column is only a BIRT concept and has nothing to do with ODA. BIRT never knows a default alias for a column from the query text. User has to specify it manually if it's needed.

In fact, from the JDBC perstive, both java.sql.ResultSetMetaData#getColumnName() and getColumnLabel() just return "NUM" too for "the select CLASSICMODELS.CUSTOMERS.CUSTOMERNUMBER as num
from CLASSICMODELS.CUSTOMERS" SQL query.
Comment 2 Maggie Shen CLA 2010-07-30 05:36:11 EDT
close.
Comment 3 Xiaoying Gu CLA 2010-08-04 22:55:43 EDT
*** Bug 321675 has been marked as a duplicate of this bug. ***
Comment 4 Jan Lerby CLA 2010-08-05 01:29:41 EDT
I created bug report in DataToolsProject

https://bugs.eclipse.org/bugs/show_bug.cgi?id=321814
Comment 5 Linda Chan CLA 2010-08-05 14:56:04 EDT
*** Bug 321814 has been marked as a duplicate of this bug. ***