It seems like we need a multiple, case insensitive map to store metadata?

------------------

Liang Zhang (John)
Apache ShardingSphere & Dubbo


tsubasaotl <[email protected]> 于2019年4月8日周一 下午7:44写道:

> Hi everybody,
> When I try to fix issue#2152[1], I can't find the best way to solve it.
> Because the case of the label will change with the database type.
>
>
> For my test, in MySQL, the result is defined by the case of the query
> field in SQL.
>   example:
>     select id from tb --> id
>     select ID from tb --> ID
>
>
> In Oracle, whatever the field is in SQL, the result must be upper case.
>   example:
>     select id from tb --> ID (will cause issue#2152[1])
>     select ID from tb --> ID
>
>
>
> And in pg, the result is lower case if SQL without double quotes
>   example:
>     select id from tb --> id
>     select ID from tb --> id (will cause issue#2152[1])
>
>
>
> But if the field in SQL with double quotes, the result will change
>    example:
>     select "ID" from tb --> ID
>
>
> There are two solutions,
> 1. Cache the real labels got from JDBC, and ignore case when get index
> from label.
> 2. Do upper or lower for Cached labels according to database type.
>
>
> The first solution may lose field for some SQL like 'select xxx as STATUS,
> status from tb' .
> The second solution may return error result for method
> `QueryResultMetaData.getColumnLabel`.
>
>
> Any advise or new solution for this issue?
>
>
> [1] https://github.com/apache/incubator-shardingsphere/issues/2152
>
>
> ------------------
> Yi Yang (Sion)
> Apache ShardingSphere

Reply via email to