Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
29492370
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
29492370
编写于
12月 21, 2019
作者:
S
slguan
提交者:
GitHub
12月 21, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #991 from taosdata/feature/liaohj
Fix the bug referred to in issue #990. [tbase-1386].
上级
b1adc3f9
4b72c79f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
16 deletion
+33
-16
src/kit/shell/inc/shell.h
src/kit/shell/inc/shell.h
+0
-1
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+21
-13
src/kit/shell/src/shellImport.c
src/kit/shell/src/shellImport.c
+12
-2
未找到文件。
src/kit/shell/inc/shell.h
浏览文件 @
29492370
...
@@ -84,7 +84,6 @@ int shellDumpResult(TAOS* con, char* fname, int* error_no, bool printMode);
...
@@ -84,7 +84,6 @@ int shellDumpResult(TAOS* con, char* fname, int* error_no, bool printMode);
void
shellPrintNChar
(
char
*
str
,
int
width
,
bool
printMode
);
void
shellPrintNChar
(
char
*
str
,
int
width
,
bool
printMode
);
void
shellGetGrantInfo
(
void
*
con
);
void
shellGetGrantInfo
(
void
*
con
);
int
isCommentLine
(
char
*
line
);
int
isCommentLine
(
char
*
line
);
#define max(a, b) ((int)(a) < (int)(b) ? (int)(b) : (int)(a))
/**************** Global variable declarations ****************/
/**************** Global variable declarations ****************/
extern
char
PROMPT_HEADER
[];
extern
char
PROMPT_HEADER
[];
...
...
src/kit/shell/src/shellEngine.c
浏览文件 @
29492370
...
@@ -16,12 +16,12 @@
...
@@ -16,12 +16,12 @@
#define _XOPEN_SOURCE
#define _XOPEN_SOURCE
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include <inttypes.h>
#include "os.h"
#include "os.h"
#include "shell.h"
#include "shell.h"
#include "shellCommand.h"
#include "shellCommand.h"
#include "ttime.h"
#include "ttime.h"
#include "tutil.h"
#include "tutil.h"
#include <regex.h>
#include <regex.h>
/**************** Global variables ****************/
/**************** Global variables ****************/
...
@@ -295,7 +295,6 @@ void shellRunCommandOnServer(TAOS *con, char command[]) {
...
@@ -295,7 +295,6 @@ void shellRunCommandOnServer(TAOS *con, char command[]) {
if
(
fname
!=
NULL
)
{
if
(
fname
!=
NULL
)
{
wordfree
(
&
full_path
);
wordfree
(
&
full_path
);
}
}
return
;
}
}
/* Function to do regular expression check */
/* Function to do regular expression check */
...
@@ -376,29 +375,29 @@ int shellDumpResult(TAOS *con, char *fname, int *error_no, bool printMode) {
...
@@ -376,29 +375,29 @@ int shellDumpResult(TAOS *con, char *fname, int *error_no, bool printMode) {
for
(
int
col
=
0
;
col
<
num_fields
;
col
++
)
{
for
(
int
col
=
0
;
col
<
num_fields
;
col
++
)
{
switch
(
fields
[
col
].
type
)
{
switch
(
fields
[
col
].
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_BOOL
:
l
[
col
]
=
max
(
BOOL_OUTPUT_LENGTH
,
strlen
(
fields
[
col
].
name
));
l
[
col
]
=
MAX
(
BOOL_OUTPUT_LENGTH
,
strlen
(
fields
[
col
].
name
));
break
;
break
;
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_TINYINT
:
l
[
col
]
=
max
(
TINYINT_OUTPUT_LENGTH
,
strlen
(
fields
[
col
].
name
));
l
[
col
]
=
MAX
(
TINYINT_OUTPUT_LENGTH
,
strlen
(
fields
[
col
].
name
));
break
;
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_SMALLINT
:
l
[
col
]
=
max
(
SMALLINT_OUTPUT_LENGTH
,
strlen
(
fields
[
col
].
name
));
l
[
col
]
=
MAX
(
SMALLINT_OUTPUT_LENGTH
,
strlen
(
fields
[
col
].
name
));
break
;
break
;
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_INT
:
l
[
col
]
=
max
(
INT_OUTPUT_LENGTH
,
strlen
(
fields
[
col
].
name
));
l
[
col
]
=
MAX
(
INT_OUTPUT_LENGTH
,
strlen
(
fields
[
col
].
name
));
break
;
break
;
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_BIGINT
:
l
[
col
]
=
max
(
BIGINT_OUTPUT_LENGTH
,
strlen
(
fields
[
col
].
name
));
l
[
col
]
=
MAX
(
BIGINT_OUTPUT_LENGTH
,
strlen
(
fields
[
col
].
name
));
break
;
break
;
case
TSDB_DATA_TYPE_FLOAT
:
case
TSDB_DATA_TYPE_FLOAT
:
l
[
col
]
=
max
(
FLOAT_OUTPUT_LENGTH
,
strlen
(
fields
[
col
].
name
));
l
[
col
]
=
MAX
(
FLOAT_OUTPUT_LENGTH
,
strlen
(
fields
[
col
].
name
));
break
;
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
case
TSDB_DATA_TYPE_DOUBLE
:
l
[
col
]
=
max
(
DOUBLE_OUTPUT_LENGTH
,
strlen
(
fields
[
col
].
name
));
l
[
col
]
=
MAX
(
DOUBLE_OUTPUT_LENGTH
,
strlen
(
fields
[
col
].
name
));
break
;
break
;
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_NCHAR
:
l
[
col
]
=
max
(
fields
[
col
].
bytes
,
strlen
(
fields
[
col
].
name
));
l
[
col
]
=
MAX
(
fields
[
col
].
bytes
,
strlen
(
fields
[
col
].
name
));
/* l[col] = max(BINARY_OUTPUT_LENGTH, strlen(fields[col].name)); */
/* l[col] = max(BINARY_OUTPUT_LENGTH, strlen(fields[col].name)); */
break
;
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
...
@@ -409,7 +408,7 @@ int shellDumpResult(TAOS *con, char *fname, int *error_no, bool printMode) {
...
@@ -409,7 +408,7 @@ int shellDumpResult(TAOS *con, char *fname, int *error_no, bool printMode) {
if
(
taos_result_precision
(
result
)
==
TSDB_TIME_PRECISION_MICRO
)
{
if
(
taos_result_precision
(
result
)
==
TSDB_TIME_PRECISION_MICRO
)
{
defaultWidth
+=
3
;
defaultWidth
+=
3
;
}
}
l
[
col
]
=
max
(
defaultWidth
,
strlen
(
fields
[
col
].
name
));
l
[
col
]
=
MAX
(
defaultWidth
,
strlen
(
fields
[
col
].
name
));
break
;
break
;
}
}
...
@@ -568,7 +567,7 @@ int shellDumpResult(TAOS *con, char *fname, int *error_no, bool printMode) {
...
@@ -568,7 +567,7 @@ int shellDumpResult(TAOS *con, char *fname, int *error_no, bool printMode) {
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_NCHAR
:
memset
(
t_str
,
0
,
TSDB_MAX_BYTES_PER_ROW
);
memset
(
t_str
,
0
,
TSDB_MAX_BYTES_PER_ROW
);
memcpy
(
t_str
,
row
[
i
],
fields
[
i
].
bytes
);
memcpy
(
t_str
,
row
[
i
],
fields
[
i
].
bytes
);
l
[
i
]
=
max
(
fields
[
i
].
bytes
,
strlen
(
fields
[
i
].
name
));
l
[
i
]
=
MAX
(
fields
[
i
].
bytes
,
strlen
(
fields
[
i
].
name
));
shellPrintNChar
(
t_str
,
l
[
i
],
printMode
);
shellPrintNChar
(
t_str
,
l
[
i
],
printMode
);
break
;
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
...
@@ -795,8 +794,17 @@ void source_file(TAOS *con, char *fptr) {
...
@@ -795,8 +794,17 @@ void source_file(TAOS *con, char *fptr) {
char
*
fname
=
full_path
.
we_wordv
[
0
];
char
*
fname
=
full_path
.
we_wordv
[
0
];
if
(
access
(
fname
,
R_OK
)
==
-
1
)
{
if
(
access
(
fname
,
F_OK
)
!=
0
)
{
fprintf
(
stderr
,
"ERROR: file %s is not exist
\n
"
,
fptr
);
wordfree
(
&
full_path
);
free
(
cmd
);
return
;
}
if
(
access
(
fname
,
R_OK
)
!=
0
)
{
fprintf
(
stderr
,
"ERROR: file %s is not readable
\n
"
,
fptr
);
fprintf
(
stderr
,
"ERROR: file %s is not readable
\n
"
,
fptr
);
wordfree
(
&
full_path
);
wordfree
(
&
full_path
);
free
(
cmd
);
free
(
cmd
);
return
;
return
;
...
...
src/kit/shell/src/shellImport.c
浏览文件 @
29492370
...
@@ -153,10 +153,20 @@ static void shellSourceFile(TAOS *con, char *fptr) {
...
@@ -153,10 +153,20 @@ static void shellSourceFile(TAOS *con, char *fptr) {
}
}
char
*
fname
=
full_path
.
we_wordv
[
0
];
char
*
fname
=
full_path
.
we_wordv
[
0
];
if
(
access
(
fname
,
R_OK
)
==
-
1
)
{
if
(
access
(
fname
,
F_OK
)
!=
0
)
{
fprintf
(
stderr
,
"ERROR: file %s is not exist
\n
"
,
fptr
);
wordfree
(
&
full_path
);
free
(
cmd
);
return
;
}
if
(
access
(
fname
,
R_OK
)
!=
0
)
{
fprintf
(
stderr
,
"ERROR: file %s is not readable
\n
"
,
fptr
);
fprintf
(
stderr
,
"ERROR: file %s is not readable
\n
"
,
fptr
);
wordfree
(
&
full_path
);
wordfree
(
&
full_path
);
free
(
cmd
);
return
;
return
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录