From 9b4f437d49d581b02335ffb62afa24aa7f414e94 Mon Sep 17 00:00:00 2001 From: zhaoyanggh Date: Mon, 21 Jun 2021 10:27:38 +0800 Subject: [PATCH] [fix] add jdbc nano second test cases --- .../TimestampPrecisionInNanoInJniTest.java | 54 ++----------------- 1 file changed, 3 insertions(+), 51 deletions(-) diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisionInNanoInJniTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisionInNanoInJniTest.java index d733209f25..68541dbe9d 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisionInNanoInJniTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/TimestampPrecisionInNanoInJniTest.java @@ -70,6 +70,9 @@ public class TimestampPrecisionInNanoInJniTest { } private void checkCount(long count, ResultSet rs) throws SQLException { + if (count == 0) { + Assert(0); + } rs.next(); long test_count = rs.getLong(1); Assert.assertEquals(count, test_count); @@ -154,9 +157,6 @@ public class TimestampPrecisionInNanoInJniTest { public void canSelectLastRowFromWeatherForFirstCol() { try (Statement stmt = conn.createStatement()) { ResultSet rs = stmt.executeQuery("select last(ts) from " + ns_timestamp_db + ".weather"); - // int nanos = rs.getTimestamp(1).getNanos(); - // Assert.assertEquals(timestamp3 % 1000_000l * 1000, nanos); - // java.lang.AssertionError: expected:<123456000> but was:<468123456> checkTime(timestamp3, rs); } catch (SQLException e) { e.printStackTrace(); @@ -417,18 +417,6 @@ public class TimestampPrecisionInNanoInJniTest { } } - // @Test - // public void canQueryNotEqualToInDateTypeForFirstCol() { - // try (Statement stmt = conn.createStatement()) { - // ResultSet rs = stmt.executeQuery("select count(*) from " + ns_timestamp_db + ".weather where ts <> '" + date3 + "'"); - // checkCount(1l, rs); - // rs = stmt.executeQuery("select ts from " + ns_timestamp_db + ".weather where ts <> '" + date3 + "'"); - // checkTime(timestamp2, rs); - // } catch (SQLException e) { - // e.printStackTrace(); - // } - // } - @Test public void canQueryNotEqualToInDateTypeForSecondCol() { try (Statement stmt = conn.createStatement()) { @@ -441,18 +429,6 @@ public class TimestampPrecisionInNanoInJniTest { } } - // @Test - // public void canQueryNotEqualToInNumberTypeForFirstCol() { - // try (Statement stmt = conn.createStatement()) { - // ResultSet rs = stmt.executeQuery("select count(*) from " + ns_timestamp_db + ".weather where ts <> '" + timestamp3 + "'"); - // checkCount(1l, rs); - // rs = stmt.executeQuery("select ts from " + ns_timestamp_db + ".weather where ts <> '" + timestamp3 + "'"); - // checkTime(timestamp2, rs); - // } catch (SQLException e) { - // e.printStackTrace(); - // } - // } - @Test public void canQueryNotEqualToInNumberTypeForSecondCol() { try (Statement stmt = conn.createStatement()) { @@ -465,18 +441,6 @@ public class TimestampPrecisionInNanoInJniTest { } } - // @Test - // public void canQueryNotEqualInDateTypeForFirstCol() { - // try (Statement stmt = conn.createStatement()) { - // ResultSet rs = stmt.executeQuery("select count(*) from " + ns_timestamp_db + ".weather where ts != '" + date3 + "'"); - // checkCount(1l, rs); - // rs = stmt.executeQuery("select ts from " + ns_timestamp_db + ".weather where ts != '" + date3 + "'"); - // checkTime(timestamp2, rs); - // } catch (SQLException e) { - // e.printStackTrace(); - // } - // } - @Test public void canQueryNotEqualInDateTypeForSecondCol() { try (Statement stmt = conn.createStatement()) { @@ -489,18 +453,6 @@ public class TimestampPrecisionInNanoInJniTest { } } - // @Test - // public void canQueryNotEqualInNumberTypeForFirstCol() { - // try (Statement stmt = conn.createStatement()) { - // ResultSet rs = stmt.executeQuery("select count(*) from " + ns_timestamp_db + ".weather where ts != '" + timestamp3 + "'"); - // checkCount(1l, rs); - // rs = stmt.executeQuery("select ts from " + ns_timestamp_db + ".weather where ts != '" + timestamp3 + "'"); - // checkTime(timestamp2, rs); - // } catch (SQLException e) { - // e.printStackTrace(); - // } - // } - @Test public void canQueryNotEqualInNumberTypeForSecondCol() { try (Statement stmt = conn.createStatement()) { -- GitLab