Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
69fe86bc
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
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看板
未验证
提交
69fe86bc
编写于
11月 16, 2020
作者:
H
huili
提交者:
GitHub
11月 16, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4173 from taosdata/hotfix/TD-2026
[TD-2026]<fix>: 'show create table' return unexpected column len
上级
9711afc5
d0a3e421
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
33 deletion
+30
-33
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+15
-3
tests/examples/c/demo.c
tests/examples/c/demo.c
+15
-30
未找到文件。
src/client/src/tscLocal.c
浏览文件 @
69fe86bc
...
@@ -619,7 +619,11 @@ static int32_t tscRebuildDDLForNormalTable(SSqlObj *pSql, const char *tableName,
...
@@ -619,7 +619,11 @@ static int32_t tscRebuildDDLForNormalTable(SSqlObj *pSql, const char *tableName,
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
uint8_t
type
=
pSchema
[
i
].
type
;
uint8_t
type
=
pSchema
[
i
].
type
;
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s(%d),"
,
pSchema
[
i
].
name
,
tDataTypeDesc
[
pSchema
[
i
].
type
].
aName
,
pSchema
->
bytes
);
int32_t
bytes
=
pSchema
[
i
].
bytes
-
VARSTR_HEADER_SIZE
;
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
bytes
=
bytes
/
TSDB_NCHAR_SIZE
;
}
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s(%d),"
,
pSchema
[
i
].
name
,
tDataTypeDesc
[
pSchema
[
i
].
type
].
aName
,
bytes
);
}
else
{
}
else
{
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s,"
,
pSchema
[
i
].
name
,
tDataTypeDesc
[
pSchema
[
i
].
type
].
aName
);
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s,"
,
pSchema
[
i
].
name
,
tDataTypeDesc
[
pSchema
[
i
].
type
].
aName
);
}
}
...
@@ -642,7 +646,11 @@ static int32_t tscRebuildDDLForSuperTable(SSqlObj *pSql, const char *tableName,
...
@@ -642,7 +646,11 @@ static int32_t tscRebuildDDLForSuperTable(SSqlObj *pSql, const char *tableName,
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
uint8_t
type
=
pSchema
[
i
].
type
;
uint8_t
type
=
pSchema
[
i
].
type
;
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s(%d),"
,
pSchema
[
i
].
name
,
tDataTypeDesc
[
pSchema
[
i
].
type
].
aName
,
pSchema
->
bytes
);
int32_t
bytes
=
pSchema
[
i
].
bytes
-
VARSTR_HEADER_SIZE
;
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
bytes
=
bytes
/
TSDB_NCHAR_SIZE
;
}
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s(%d),"
,
pSchema
[
i
].
name
,
tDataTypeDesc
[
pSchema
[
i
].
type
].
aName
,
bytes
);
}
else
{
}
else
{
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s,"
,
pSchema
[
i
].
name
,
tDataTypeDesc
[
type
].
aName
);
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s,"
,
pSchema
[
i
].
name
,
tDataTypeDesc
[
type
].
aName
);
}
}
...
@@ -652,7 +660,11 @@ static int32_t tscRebuildDDLForSuperTable(SSqlObj *pSql, const char *tableName,
...
@@ -652,7 +660,11 @@ static int32_t tscRebuildDDLForSuperTable(SSqlObj *pSql, const char *tableName,
for
(
int32_t
i
=
numOfRows
;
i
<
totalRows
;
i
++
)
{
for
(
int32_t
i
=
numOfRows
;
i
<
totalRows
;
i
++
)
{
uint8_t
type
=
pSchema
[
i
].
type
;
uint8_t
type
=
pSchema
[
i
].
type
;
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s(%d),"
,
pSchema
[
i
].
name
,
tDataTypeDesc
[
pSchema
[
i
].
type
].
aName
,
pSchema
->
bytes
);
int32_t
bytes
=
pSchema
[
i
].
bytes
-
VARSTR_HEADER_SIZE
;
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
bytes
=
bytes
/
TSDB_NCHAR_SIZE
;
}
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s(%d),"
,
pSchema
[
i
].
name
,
tDataTypeDesc
[
pSchema
[
i
].
type
].
aName
,
bytes
);
}
else
{
}
else
{
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s,"
,
pSchema
[
i
].
name
,
tDataTypeDesc
[
type
].
aName
);
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s,"
,
pSchema
[
i
].
name
,
tDataTypeDesc
[
type
].
aName
);
}
}
...
...
tests/examples/c/demo.c
浏览文件 @
69fe86bc
...
@@ -50,10 +50,10 @@ static void queryDB(TAOS *taos, char *command) {
...
@@ -50,10 +50,10 @@ static void queryDB(TAOS *taos, char *command) {
taos_free_result
(
pSql
);
taos_free_result
(
pSql
);
}
}
void
Test
(
char
*
qstr
,
const
char
*
input
,
int
i
);
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
TAOS
*
taos
;
char
qstr
[
1024
];
char
qstr
[
1024
];
TAOS_RES
*
result
;
// connect to server
// connect to server
if
(
argc
<
2
)
{
if
(
argc
<
2
)
{
...
@@ -63,41 +63,26 @@ int main(int argc, char *argv[]) {
...
@@ -63,41 +63,26 @@ int main(int argc, char *argv[]) {
// init TAOS
// init TAOS
taos_init
();
taos_init
();
for
(
int
i
=
0
;
i
<
4000000
;
i
++
)
{
taos
=
taos_connect
(
argv
[
1
],
"root"
,
"taosdata"
,
NULL
,
0
);
Test
(
qstr
,
argv
[
1
],
i
);
}
taos_cleanup
();
}
void
Test
(
char
*
qstr
,
const
char
*
input
,
int
index
)
{
TAOS
*
taos
=
taos_connect
(
input
,
"root"
,
"taosdata"
,
NULL
,
0
);
printf
(
"==================test at %d
\n
================================"
,
index
);
queryDB
(
taos
,
"drop database if exists demo"
);
queryDB
(
taos
,
"create database demo"
);
TAOS_RES
*
result
;
if
(
taos
==
NULL
)
{
if
(
taos
==
NULL
)
{
printf
(
"failed to connect to server, reason:%s
\n
"
,
"null taos"
/*taos_errstr(taos)*/
);
printf
(
"failed to connect to server, reason:%s
\n
"
,
"null taos"
/*taos_errstr(taos)*/
);
exit
(
1
);
exit
(
1
);
}
}
printf
(
"success to connect to server
\n
"
);
//taos_query(taos, "drop database demo");
queryDB
(
taos
,
"drop database if exists demo"
);
//result = taos_query(taos, "create database demo");
//if (result == NULL) {
// printf("failed to create database, reason:%s\n", "null result"/*taos_errstr(taos)*/);
// exit(1);
//}
queryDB
(
taos
,
"create database demo"
);
printf
(
"success to create database
\n
"
);
//taos_query(taos, "use demo");
queryDB
(
taos
,
"use demo"
);
queryDB
(
taos
,
"use demo"
);
// create table
//if (taos_query(taos, "create table m1 (ts timestamp, ti tinyint, si smallint, i int, bi bigint, f float, d double, b binary(10))") == 0) {
// printf("failed to create table, reason:%s\n", taos_errstr(result));
// exit(1);
//}
queryDB
(
taos
,
"create table m1 (ts timestamp, ti tinyint, si smallint, i int, bi bigint, f float, d double, b binary(10))"
);
queryDB
(
taos
,
"create table m1 (ts timestamp, ti tinyint, si smallint, i int, bi bigint, f float, d double, b binary(10))"
);
printf
(
"success to create table
\n
"
);
printf
(
"success to create table
\n
"
);
// sleep for one second to make sure table is created on data node
// taosMsleep(1000);
// insert 10 records
int
i
=
0
;
int
i
=
0
;
for
(
i
=
0
;
i
<
10
;
++
i
)
{
for
(
i
=
0
;
i
<
10
;
++
i
)
{
sprintf
(
qstr
,
"insert into m1 values (%"
PRId64
", %d, %d, %d, %d, %f, %lf, '%s')"
,
1546300800000
+
i
*
1000
,
i
,
i
,
i
,
i
*
10000000
,
i
*
1
.
0
,
i
*
2
.
0
,
"hello"
);
sprintf
(
qstr
,
"insert into m1 values (%"
PRId64
", %d, %d, %d, %d, %f, %lf, '%s')"
,
1546300800000
+
i
*
1000
,
i
,
i
,
i
,
i
*
10000000
,
i
*
1
.
0
,
i
*
2
.
0
,
"hello"
);
...
@@ -117,7 +102,6 @@ int main(int argc, char *argv[]) {
...
@@ -117,7 +102,6 @@ int main(int argc, char *argv[]) {
}
}
taos_free_result
(
result
);
taos_free_result
(
result
);
//sleep(1);
}
}
printf
(
"success to insert rows, total %d rows
\n
"
,
i
);
printf
(
"success to insert rows, total %d rows
\n
"
,
i
);
...
@@ -147,5 +131,6 @@ int main(int argc, char *argv[]) {
...
@@ -147,5 +131,6 @@ int main(int argc, char *argv[]) {
taos_free_result
(
result
);
taos_free_result
(
result
);
printf
(
"====demo end====
\n\n
"
);
printf
(
"====demo end====
\n\n
"
);
return
getchar
(
);
taos_close
(
taos
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录