diff --git a/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/utils/SqlSpeller.java b/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/utils/SqlSpeller.java index 349fbfdb7b9bcb6efe56a8d2e87697bee922cc35..78489b0de75e35119efdde842130c7a2206d468f 100644 --- a/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/utils/SqlSpeller.java +++ b/tests/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/utils/SqlSpeller.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; +import java.util.stream.IntStream; public class SqlSpeller { @@ -64,10 +65,18 @@ public class SqlSpeller { //f1, f2, f3 private static String fieldValues(List fields) { - return fields.stream() - .filter(Objects::nonNull) - .map(fieldValue -> "'" + fieldValue.getValue() + "'") - .collect(Collectors.joining(",", "(", ")")); + return IntStream.range(0, fields.size()).mapToObj(i -> { + if (i == 0) { + return "" + fields.get(i).getName() + ""; + } else { + return "'" + fields.get(i).getValue() + "'"; + } + }).collect(Collectors.joining(",", "(", ")")); + +// return fields.stream() +// .filter(Objects::nonNull) +// .map(fieldValue -> "'" + fieldValue.getValue() + "'") +// .collect(Collectors.joining(",", "(", ")")); } //(f1, f2, f3),(f1, f2, f3) diff --git a/tests/examples/JDBC/taosdemo/src/test/java/com/taosdata/taosdemo/utils/TimeStampUtilTest.java b/tests/examples/JDBC/taosdemo/src/test/java/com/taosdata/taosdemo/utils/TimeStampUtilTest.java index 195db2b13efaec5b9d2451fbaff9c36f2bc41ac8..628594c4b18008fd9e278bb6d23d0d5f87489b56 100644 --- a/tests/examples/JDBC/taosdemo/src/test/java/com/taosdata/taosdemo/utils/TimeStampUtilTest.java +++ b/tests/examples/JDBC/taosdemo/src/test/java/com/taosdata/taosdemo/utils/TimeStampUtilTest.java @@ -17,9 +17,6 @@ public class TimeStampUtilTest { @Test public void longToDatetime() { - System.out.println(TimeStampUtil.longToDatetime(1293244920052l)); - - String datetime = TimeStampUtil.longToDatetime(1510000000000L); assertEquals("2017-11-07 04:26:40.000", datetime); long timestamp = TimeStampUtil.datetimeToLong(datetime);