Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d632f035
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
d632f035
编写于
3月 10, 2023
作者:
H
huolibo
提交者:
GitHub
3月 10, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: adapter 3.0 (#20391)
上级
1bb976a5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
7 addition
and
26 deletion
+7
-26
docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java
...ain/java/com/taos/example/highvolume/DataBaseMonitor.java
+5
-16
docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java
.../src/main/java/com/taos/example/highvolume/SQLWriter.java
+2
-10
未找到文件。
docs/examples/java/src/main/java/com/taos/example/highvolume/DataBaseMonitor.java
浏览文件 @
d632f035
...
...
@@ -36,28 +36,17 @@ public class DataBaseMonitor {
stmt
.
execute
(
"CREATE STABLE test.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)"
);
}
public
Long
count
()
throws
SQLException
{
if
(!
stmt
.
isClosed
())
{
ResultSet
result
=
stmt
.
executeQuery
(
"SELECT count(*) from test.meters"
);
public
long
count
()
throws
SQLException
{
try
(
ResultSet
result
=
stmt
.
executeQuery
(
"SELECT count(*) from test.meters"
))
{
result
.
next
();
return
result
.
getLong
(
1
);
}
return
null
;
}
/**
* show test.stables;
*
* name | created_time | columns | tags | tables |
* ============================================================================================
* meters | 2022-07-20 08:39:30.902 | 4 | 2 | 620000 |
*/
public
Long
getTableCount
()
throws
SQLException
{
if
(!
stmt
.
isClosed
())
{
ResultSet
result
=
stmt
.
executeQuery
(
"show test.stables"
);
public
long
getTableCount
()
throws
SQLException
{
try
(
ResultSet
result
=
stmt
.
executeQuery
(
"select count(*) from information_schema.ins_tables where db_name = 'test';"
))
{
result
.
next
();
return
result
.
getLong
(
5
);
return
result
.
getLong
(
1
);
}
return
null
;
}
}
\ No newline at end of file
docs/examples/java/src/main/java/com/taos/example/highvolume/SQLWriter.java
浏览文件 @
d632f035
...
...
@@ -42,7 +42,7 @@ public class SQLWriter {
/**
* Maximum SQL length.
*/
private
int
maxSQLLength
;
private
int
maxSQLLength
=
800_000
;
/**
* Map from table name to column values. For example:
...
...
@@ -81,14 +81,6 @@ public class SQLWriter {
conn
=
getConnection
();
stmt
=
conn
.
createStatement
();
stmt
.
execute
(
"use test"
);
ResultSet
rs
=
stmt
.
executeQuery
(
"show variables"
);
while
(
rs
.
next
())
{
String
configName
=
rs
.
getString
(
1
);
if
(
"maxSQLLength"
.
equals
(
configName
))
{
maxSQLLength
=
Integer
.
parseInt
(
rs
.
getString
(
2
));
logger
.
info
(
"maxSQLLength={}"
,
maxSQLLength
);
}
}
}
/**
...
...
@@ -149,7 +141,7 @@ public class SQLWriter {
}
catch
(
SQLException
e
)
{
// convert to error code defined in taoserror.h
int
errorCode
=
e
.
getErrorCode
()
&
0xffff
;
if
(
errorCode
==
0x
362
||
errorCode
==
0x218
)
{
if
(
errorCode
==
0x
2603
)
{
// Table does not exist
createTables
();
executeSQL
(
sql
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录