Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RestfulDriver column name ignore case #212

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

lrzl
Copy link

@lrzl lrzl commented Jan 13, 2025

因数据库列名不区分大小写,使用大写的列名寻找数据会导致找不到列
问题复现步骤:

  1. 创建表
create table column_name_test (ts timestamp,col NCHAR (64)) tags (t NCHAR (64))
  1. 写入数据
insert into data_1 using column_name_test tags ('test tag') values ('2025-01-13 00:00:00','test data');
select * from column_name_test;
           ts            |              col               |               t                |
============================================================================================
 2025-01-13 00:00:00.000 | test data                      | test tag                       |
Query OK, 1 row(s) in set (0.001425s)

3.配置RestfulDriver

... 省略
<property name="jdbcUrl" value="jdbc:TAOS-RS://tdengine:6041/unittest"/>
<property name="driverClassName" value="com.taosdata.jdbc.rs.RestfulDriver"/>
... 省略

3.执行

...
try (Connection connection = hikariDataSource.getConnection()){
              ResultSet resultSet = connection.prepareStatement("select * from column_name_test").executeQuery();
              if (resultSet.next()){
                  System.out.println("get col value:" + resultSet.getObject("col"));
                  System.out.println("get COL value:" +resultSet.getObject("COL"));
              }
 }
...

结果

get col value:test data
java.lang.RuntimeException: java.sql.SQLException: cannot find Column in resultSet

	at ...省略
Caused by: java.sql.SQLException: cannot find Column in resultSet
	at com.taosdata.jdbc.rs.RestfulResultSet.findColumn(RestfulResultSet.java:488)
	at com.taosdata.jdbc.AbstractResultSet.getObject(AbstractResultSet.java:236)
	at com.zaxxer.hikari.pool.HikariProxyResultSet.getObject(HikariProxyResultSet.java)
	at ..省略
	... 28 more

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 70.39%. Comparing base (480506c) to head (d62e8c8).
Report is 22 commits behind head on main.

Files with missing lines Patch % Lines
...in/java/com/taosdata/jdbc/rs/RestfulResultSet.java 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #212      +/-   ##
============================================
- Coverage     70.60%   70.39%   -0.22%     
+ Complexity     3012     2999      -13     
============================================
  Files           152      152              
  Lines          9933     9933              
  Branches       1204     1205       +1     
============================================
- Hits           7013     6992      -21     
- Misses         2096     2103       +7     
- Partials        824      838      +14     
Flag Coverage Δ
unittests 70.39% <50.00%> (-0.22%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants