Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2e6f68ab
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2e6f68ab
编写于
11月 23, 2021
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
revert [change json output format]
上级
0b54133a
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
10 addition
and
40 deletion
+10
-40
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+3
-12
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+7
-28
未找到文件。
src/client/src/tscLocal.c
浏览文件 @
2e6f68ab
...
...
@@ -215,7 +215,7 @@ static int32_t tscProcessDescribeTable(SSqlObj *pSql) {
return
tscSetValueToResObj
(
pSql
,
rowLen
);
}
static
int32_t
tscGetNthFieldResult
(
TAOS_ROW
row
,
TAOS_FIELD
*
fields
,
int
*
lengths
,
int
idx
,
char
*
result
)
{
c
har
*
val
=
(
char
*
)
row
[
idx
];
c
onst
char
*
val
=
(
const
char
*
)
row
[
idx
];
if
(
val
==
NULL
)
{
sprintf
(
result
,
"%s"
,
TSDB_DATA_NULL_STR
);
return
-
1
;
...
...
@@ -223,16 +223,6 @@ static int32_t tscGetNthFieldResult(TAOS_ROW row, TAOS_FIELD* fields, int *lengt
uint8_t
type
=
fields
[
idx
].
type
;
int32_t
length
=
lengths
[
idx
];
if
(
type
==
TSDB_DATA_TYPE_JSON
){
char
*
p
=
val
;
type
=
*
p
;
val
+=
CHAR_BYTES
;
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
length
=
varDataLen
(
val
);
val
=
varDataVal
(
val
);
}
}
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
sprintf
(
result
,
"%s"
,
((((
int32_t
)(
*
((
char
*
)
val
)))
==
1
)
?
"true"
:
"false"
));
...
...
@@ -257,6 +247,7 @@ static int32_t tscGetNthFieldResult(TAOS_ROW row, TAOS_FIELD* fields, int *lengt
break
;
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_JSON
:
memcpy
(
result
,
val
,
length
);
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
...
...
src/kit/shell/src/shellEngine.c
浏览文件 @
2e6f68ab
...
...
@@ -470,23 +470,12 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) {
}
static
void
dumpFieldToFile
(
FILE
*
fp
,
char
*
val
,
TAOS_FIELD
*
field
,
int32_t
length
,
int
precision
)
{
static
void
dumpFieldToFile
(
FILE
*
fp
,
c
onst
c
har
*
val
,
TAOS_FIELD
*
field
,
int32_t
length
,
int
precision
)
{
if
(
val
==
NULL
)
{
fprintf
(
fp
,
"%s"
,
TSDB_DATA_NULL_STR
);
return
;
}
uint8_t
type
=
field
->
type
;
if
(
type
==
TSDB_DATA_TYPE_JSON
){
char
*
p
=
val
;
type
=
*
p
;
val
+=
CHAR_BYTES
;
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
length
=
varDataLen
(
val
);
val
=
varDataVal
(
val
);
}
}
char
buf
[
TSDB_MAX_BYTES_PER_ROW
];
switch
(
field
->
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
...
...
@@ -567,7 +556,7 @@ static int dumpResultToFile(const char* fname, TAOS_RES* tres) {
if
(
i
>
0
)
{
fputc
(
','
,
fp
);
}
dumpFieldToFile
(
fp
,
row
[
i
],
fields
+
i
,
length
[
i
],
precision
);
dumpFieldToFile
(
fp
,
(
const
char
*
)
row
[
i
],
fields
+
i
,
length
[
i
],
precision
);
}
fputc
(
'\n'
,
fp
);
...
...
@@ -646,7 +635,7 @@ static void shellPrintNChar(const char *str, int length, int width) {
}
static
void
printField
(
char
*
val
,
TAOS_FIELD
*
field
,
int
width
,
int32_t
length
,
int
precision
)
{
static
void
printField
(
c
onst
c
har
*
val
,
TAOS_FIELD
*
field
,
int
width
,
int32_t
length
,
int
precision
)
{
if
(
val
==
NULL
)
{
int
w
=
width
;
if
(
field
->
type
<
TSDB_DATA_TYPE_TINYINT
||
field
->
type
>
TSDB_DATA_TYPE_DOUBLE
)
{
...
...
@@ -659,19 +648,8 @@ static void printField(char* val, TAOS_FIELD* field, int width, int32_t length,
return
;
}
uint8_t
type
=
field
->
type
;
if
(
type
==
TSDB_DATA_TYPE_JSON
){
char
*
p
=
val
;
type
=
*
p
;
val
+=
CHAR_BYTES
;
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
length
=
varDataLen
(
val
);
val
=
varDataVal
(
val
);
}
}
char
buf
[
TSDB_MAX_BYTES_PER_ROW
];
switch
(
type
)
{
switch
(
field
->
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
printf
(
"%*s"
,
width
,
((((
int32_t
)(
*
((
char
*
)
val
)))
==
1
)
?
"true"
:
"false"
));
break
;
...
...
@@ -707,6 +685,7 @@ static void printField(char* val, TAOS_FIELD* field, int width, int32_t length,
break
;
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_JSON
:
shellPrintNChar
(
val
,
length
,
width
);
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
...
...
@@ -768,7 +747,7 @@ static int verticalPrintResult(TAOS_RES* tres) {
int
padding
=
(
int
)(
maxColNameLen
-
strlen
(
field
->
name
));
printf
(
"%*.s%s: "
,
padding
,
" "
,
field
->
name
);
printField
(
row
[
i
],
field
,
0
,
length
[
i
],
precision
);
printField
(
(
const
char
*
)
row
[
i
],
field
,
0
,
length
[
i
],
precision
);
putchar
(
'\n'
);
}
}
else
if
(
showMore
)
{
...
...
@@ -898,7 +877,7 @@ static int horizontalPrintResult(TAOS_RES* tres) {
if
(
numOfRows
<
resShowMaxNum
)
{
for
(
int
i
=
0
;
i
<
num_fields
;
i
++
)
{
putchar
(
' '
);
printField
(
row
[
i
],
fields
+
i
,
width
[
i
],
length
[
i
],
precision
);
printField
(
(
const
char
*
)
row
[
i
],
fields
+
i
,
width
[
i
],
length
[
i
],
precision
);
putchar
(
' '
);
putchar
(
'|'
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录