tdengine event子表修改TAG(device_code,device_name)

This commit is contained in:
huguanghan 2024-11-28 17:10:51 +08:00
parent 7e4ee1323f
commit 4cca0a4cc2
2 changed files with 3 additions and 3 deletions

View File

@ -809,7 +809,7 @@ public class TDEngineService {
public Boolean checkTableExist(String tableName){ public Boolean checkTableExist(String tableName){
StringBuffer sb = new StringBuffer(256); StringBuffer sb = new StringBuffer(256);
sb.append("select count(*) from information_schema.ins_tables where table_name = '"); sb.append("select count(*) as tablecount from information_schema.ins_tables where table_name = '");
sb.append(tableName); sb.append(tableName);
sb.append("'"); sb.append("'");
Integer result = null; Integer result = null;
@ -817,7 +817,7 @@ public class TDEngineService {
Statement smt = conn.createStatement(); Statement smt = conn.createStatement();
ResultSet rs = smt.executeQuery(sb.toString())) { ResultSet rs = smt.executeQuery(sb.toString())) {
if (rs.next()) { if (rs.next()) {
result = rs.getInt("count"); result = rs.getInt("tablecount");
} }
} catch (Exception e) { } catch (Exception e) {
log.error("检查td表是否存在失败", e); log.error("检查td表是否存在失败", e);

View File

@ -102,5 +102,5 @@ logging:
tdengine: tdengine:
password: taosdata password: taosdata
url: jdbc:TAOS-RS://192.168.109.160:6041/das url: jdbc:TAOS-RS://192.168.109.187:6041/das
username: root username: root