change
This commit is contained in:
parent
40f4534f2a
commit
a792e6c3d0
|
@ -6,6 +6,7 @@ import com.taosdata.jdbc.TSDBResultSet;
|
||||||
import com.taosdata.jdbc.TSDBSubscribe;
|
import com.taosdata.jdbc.TSDBSubscribe;
|
||||||
|
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.ResultSetMetaData;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@ -50,11 +51,16 @@ public class SubscribeDemo {
|
||||||
while (true) {
|
while (true) {
|
||||||
TSDBResultSet rs = sub.consume();
|
TSDBResultSet rs = sub.consume();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
ResultSetMetaData meta = rs.getMetaData();
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
for (int i = 1; i <= meta.getColumnCount(); i++) {
|
||||||
|
System.out.print(meta.getColumnLabel(i) + ": " + rs.getString(i) + "\t");
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
total += count;
|
total += count;
|
||||||
System.out.printf("%d rows consumed, total %d\n", count, total);
|
// System.out.printf("%d rows consumed, total %d\n", count, total);
|
||||||
if (total >= 10)
|
if (total >= 10)
|
||||||
break;
|
break;
|
||||||
TimeUnit.SECONDS.sleep(1);
|
TimeUnit.SECONDS.sleep(1);
|
||||||
|
|
Loading…
Reference in New Issue