@@ -17,6 +17,7 @@ public class WsEfficientWritingTest {
1717 private final String tableName = "wpt" ;
1818 private final String tableNameCopyData = "wpt_cp" ;
1919 private final String tableReconnect = "wpt_rc" ;
20+ private final String tableNcharTag = "wpt_nchar" ;
2021 private final String asyncSqlTable = tableReconnect ;
2122 private Connection connection ;
2223 private TaosAdapterMock taosAdapterMock ;
@@ -70,7 +71,7 @@ public void testStmt2InsertStdApiNoTag() throws SQLException {
7071 }
7172
7273 Assert .assertEquals (numOfSubTable * numOfRow , Utils .getSqlRows (connection , db_name + "." + tableName ));
73- }
74+ }
7475
7576 @ Test
7677 public void testCopyData () throws SQLException {
@@ -347,6 +348,24 @@ public void testColumnDataCloseBatchThrowsSQLException() throws SQLException {
347348 }
348349 }
349350
351+ @ Test (expected = SQLException .class )
352+ public void testNcharTagThrowsSQLException () throws SQLException {
353+ String sql = "INSERT INTO " + db_name + "." + tableNcharTag + "(tbname, ts, i, tag_nchar) VALUES (?,?,?,?)" ;
354+ try (Connection con = getConnection (false );
355+ PreparedStatement pstmt = con .prepareStatement (sql )) {
356+ long current = System .currentTimeMillis ();
357+ for (int i = 0 ; i < 1000 ; i ++) {
358+ pstmt .setString (1 , "ncahr_bind_1" );
359+ pstmt .setTimestamp (2 , new Timestamp (current + i ));
360+ pstmt .setInt (3 , 100 );
361+ pstmt .setString (4 , "中国人" );
362+ pstmt .addBatch ();
363+ pstmt .executeBatch ();
364+ }
365+ pstmt .executeUpdate ();
366+ }
367+ }
368+
350369 @ Before
351370 public void before () throws SQLException {
352371 connection = getConnection (false );
@@ -357,6 +376,8 @@ public void before() throws SQLException {
357376 statement .execute ("create stable if not exists " + db_name + "." + tableName + " (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupId INT, location BINARY(24))" );
358377 statement .execute ("create stable if not exists " + db_name + "." + tableNameCopyData + " (ts TIMESTAMP, b varbinary(10)) TAGS (groupId INT)" );
359378 statement .execute ("create stable if not exists " + db_name + "." + tableReconnect + " (ts TIMESTAMP, i INT) TAGS (groupId INT)" );
379+ statement .execute ("create stable if not exists " + db_name + "." + tableNcharTag + " (ts TIMESTAMP, i INT) TAGS (tag_nchar nchar(100))" );
380+
360381 statement .close ();
361382
362383 createSubTable ();
0 commit comments