[CONJ-163] make column label name display instead column name when useOldAliasMetadataBehavior option true Created: 2015-06-24  Updated: 2015-09-02  Resolved: 2015-07-22

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.1.9
Fix Version/s: 1.2.2

Type: Task Priority: Major
Reporter: seung hoon yoo Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None
Environment:

ALL


Issue Links:
Relates
relates to CONJ-149 ResultSetMetaData.getTableName return... Closed
Sprint: Sprint connector/j 1.3.0

 Description   

Like CONJ-149, column alias display feature need.

as_is

select col_1 as col_A from test_table;
:  getColumnName return col_1
 

i need feature about useOldAliasMetadataBehavior option (like CONJ-149 TABLE)
when useOldAliasMetadataBehavior is true

select col_1 as col_A from test_table;
:  getColumnName return col_A

that make column label name display instead column name when useOldAliasMetadataBehavior option true

how about my idea,
and sample my code is below

MySQLResultSetMetaData.java

 public String getColumnName(final int column) throws SQLException {
        String s =  getColumnInformation(column).getOriginalName();      
+        if (returnTableAlias == true)    // if useOldAliasMetadataBehavior=true then getColumnName return getCoulmnLabel
+         s =  getColumnLabel(column); 
      
        if ("".equals(s))  // odd things that are no columns, e.g count(*)
            s =  getColumnLabel(column);
        return s;
    }



 Comments   
Comment by Diego Dupin [ 2015-07-11 ]

getColumnLabel must be your solution :

select col_1 as col_A from test_table;
:  getColumnName return col_1
:  getColumnLabel return col_A

JDBC-4.0 indicate that there is 2 differents things :

  • getColumnName will have the physical name
  • getColumnLabel will be the alias if defined, the physical name if not.

Does it not answer your needs ?

Comment by seung hoon yoo [ 2015-07-13 ]

getColumnLabel is solution.
I agree,
BUT,
1. mysql client supports useOldAliasMetadataBehavior option about column alias
2. Some package solution application code was used getColumnName instead of getColumnLagel
(using with useOldAliasMetadataBehavior=true)

My situation some package developer says,
" Our package run in mysql envirment(useOldAliasMetadataBehavior=ture), but mariadb does not"
so I want mariadb support more (old) package or appliation.
and it's more Compatible with mysql feature.

Comment by Diego Dupin [ 2015-07-22 ]

done as requested for mysql compatibility

Generated at Thu Feb 08 03:13:38 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.