change
This commit is contained in:
parent
3ce4dd3dbb
commit
62ddd55b15
|
@ -30,8 +30,9 @@ public class SubscribeTest {
|
||||||
connection = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/", properties);
|
connection = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/", properties);
|
||||||
|
|
||||||
statement = connection.createStatement();
|
statement = connection.createStatement();
|
||||||
statement.executeUpdate("create database if not exists " + dbName);
|
statement.execute("drop database if exists " + dbName);
|
||||||
statement.executeUpdate("create table if not exists " + dbName + "." + tName + " (ts timestamp, k int, v int)");
|
statement.execute("create database if not exists " + dbName);
|
||||||
|
statement.execute("create table if not exists " + dbName + "." + tName + " (ts timestamp, k int, v int)");
|
||||||
long ts = System.currentTimeMillis();
|
long ts = System.currentTimeMillis();
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
ts += i;
|
ts += i;
|
||||||
|
@ -45,13 +46,12 @@ public class SubscribeTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void subscribe() throws Exception {
|
public void subscribe() {
|
||||||
TSDBSubscribe subscribe = null;
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
String rawSql = "select * from " + dbName + "." + tName + ";";
|
String rawSql = "select * from " + dbName + "." + tName + ";";
|
||||||
System.out.println(rawSql);
|
System.out.println(rawSql);
|
||||||
subscribe = ((TSDBConnection) connection).subscribe(topic, rawSql, false);
|
TSDBSubscribe subscribe = ((TSDBConnection) connection).subscribe(topic, rawSql, false);
|
||||||
|
|
||||||
int a = 0;
|
int a = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -69,12 +69,10 @@ public class SubscribeTest {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subscribe.close(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
|
||||||
if (null != subscribe) {
|
|
||||||
subscribe.close(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue