From fe35dfb9ff85e50f72598541d5b2eb4b3a4cf02f Mon Sep 17 00:00:00 2001 From: zyyang Date: Thu, 4 Feb 2021 11:23:09 +0800 Subject: [PATCH] change --- .../cases/InvalidResultSetPointerTest.java | 54 +++++++++++++++---- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InvalidResultSetPointerTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InvalidResultSetPointerTest.java index 887bfd89d2..ea2dbd9b96 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InvalidResultSetPointerTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InvalidResultSetPointerTest.java @@ -10,8 +10,8 @@ public class InvalidResultSetPointerTest { private static String host = "127.0.0.1"; private static final String dbName = "test"; - private static final String stbName = "meters"; - private static final String tbName = "meters"; + private static final String stbName = "stb"; + private static final String tbName = "tb"; private static Connection connection; private static int numOfSTb = 300000; private static int numOfTb = 3; @@ -19,8 +19,51 @@ public class InvalidResultSetPointerTest { @Test public void test() throws SQLException { + execute("drop database if exists " + dbName); + execute("create database if not exists " + dbName); execute("use " + dbName); + execute("drop table if exists " + dbName + "." + stbName + ""); + createSTable(); + createTable(); + insert(); + selectMultiThreading(); + close(); + } + private void insert() { + for (int i = 0; i < numOfSTb; i++) { + for (int j = 0; j < numOfTb; j++) { + final String sql = "INSERT INTO " + dbName + "." + tbName + i + "_" + j + " (ts, temperature, humidity, name) values(now, 20.5, 34, \"" + i + "\")"; + System.out.println(sql); + execute(sql); + } + } + } + + private void createSTable() { + for (int i = 0; i < numOfSTb; i++) { + final String sql = "create table if not exists " + dbName + "." + stbName + i + " (ts timestamp, temperature float, humidity int, name BINARY(" + (i % 73 + 10) + ")) TAGS (tag1 INT)"; + execute(sql); + } + } + + private void createTable() { + for (int i = 0; i < numOfSTb; i++) { + for (int j = 0; j < numOfTb; j++) { + final String sql = "create table if not exists " + dbName + "." + tbName + i + "_" + j + " USING " + stbName + i + " TAGS(" + j + ")"; + execute(sql); + } + } + } + + private void close() throws SQLException { + if (connection != null) { + this.connection.close(); + System.out.println("connection closed."); + } + } + + private void selectMultiThreading() { int a = numOfSTb / numOfThreads; if (a < 1) { numOfThreads = numOfSTb; @@ -60,11 +103,6 @@ public class InvalidResultSetPointerTest { ie.printStackTrace(); } } - - if (connection != null) { - this.connection.close(); - System.out.println("connection closed."); - } } @BeforeClass @@ -145,8 +183,6 @@ public class InvalidResultSetPointerTest { } } } - - } } -- GitLab