Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
656128d9
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看板
提交
656128d9
编写于
5月 28, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into feature/query
上级
bfcdbf76
6d4d454d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
49 addition
and
89 deletion
+49
-89
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+4
-1
src/kit/shell/inc/shell.h
src/kit/shell/inc/shell.h
+0
-1
src/kit/shell/src/shellDarwin.c
src/kit/shell/src/shellDarwin.c
+0
-25
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+36
-3
src/kit/shell/src/shellLinux.c
src/kit/shell/src/shellLinux.c
+0
-24
src/kit/shell/src/shellWindows.c
src/kit/shell/src/shellWindows.c
+0
-26
src/util/inc/tutil.h
src/util/inc/tutil.h
+1
-1
src/util/src/tutil.c
src/util/src/tutil.c
+8
-8
未找到文件。
src/client/src/tscSubquery.c
浏览文件 @
656128d9
...
...
@@ -1888,11 +1888,14 @@ static void transferNcharData(SSqlObj *pSql, int32_t columnIndex, TAOS_FIELD *pF
/* string terminated char for binary data*/
memset
(
pRes
->
buffer
[
columnIndex
],
0
,
pField
->
bytes
+
TSDB_NCHAR_SIZE
);
if
(
taosUcs4ToMbs
(
pRes
->
tsrow
[
columnIndex
],
pField
->
bytes
-
VARSTR_HEADER_SIZE
,
pRes
->
buffer
[
columnIndex
]))
{
int32_t
length
=
taosUcs4ToMbs
(
pRes
->
tsrow
[
columnIndex
],
pRes
->
length
[
columnIndex
],
pRes
->
buffer
[
columnIndex
]);
if
(
length
>=
0
)
{
pRes
->
tsrow
[
columnIndex
]
=
pRes
->
buffer
[
columnIndex
];
pRes
->
length
[
columnIndex
]
=
length
;
}
else
{
tscError
(
"%p charset:%s to %s. val:%ls convert failed."
,
pSql
,
DEFAULT_UNICODE_ENCODEC
,
tsCharset
,
pRes
->
tsrow
[
columnIndex
]);
pRes
->
tsrow
[
columnIndex
]
=
NULL
;
pRes
->
length
[
columnIndex
]
=
0
;
}
}
}
...
...
src/kit/shell/inc/shell.h
浏览文件 @
656128d9
...
...
@@ -68,7 +68,6 @@ void get_history_path(char* history);
void
cleanup_handler
(
void
*
arg
);
void
exitShell
();
int
shellDumpResult
(
TAOS
*
con
,
char
*
fname
,
int
*
error_no
,
bool
printMode
);
void
shellPrintNChar
(
const
char
*
str
,
int
length
,
int
width
);
void
shellGetGrantInfo
(
void
*
con
);
int
isCommentLine
(
char
*
line
);
...
...
src/kit/shell/src/shellDarwin.c
浏览文件 @
656128d9
...
...
@@ -349,31 +349,6 @@ void *shellLoopQuery(void *arg) {
return
NULL
;
}
void
shellPrintNChar
(
const
char
*
str
,
int
length
,
int
width
)
{
int
pos
=
0
,
cols
=
0
;
while
(
pos
<
length
)
{
wchar_t
wc
;
pos
+=
mbtowc
(
&
wc
,
str
+
pos
,
MB_CUR_MAX
);
if
(
pos
>
length
)
{
break
;
}
int
w
=
wcwidth
(
wc
);
if
(
w
>
0
)
{
if
(
width
>
0
&&
cols
+
w
>
width
)
{
break
;
}
printf
(
"%lc"
,
wc
);
cols
+=
w
;
}
}
for
(;
cols
<
width
;
cols
++
)
{
putchar
(
' '
);
}
}
int
get_old_terminal_mode
(
struct
termios
*
tio
)
{
/* Make sure stdin is a terminal. */
if
(
!
isatty
(
STDIN_FILENO
))
{
...
...
src/kit/shell/src/shellEngine.c
浏览文件 @
656128d9
...
...
@@ -435,7 +435,6 @@ static int dumpResultToFile(const char* fname, TAOS_RES* result) {
int
num_fields
=
taos_num_fields
(
result
);
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
result
);
int32_t
*
length
=
taos_fetch_lengths
(
result
);
int
precision
=
taos_result_precision
(
result
);
for
(
int
col
=
0
;
col
<
num_fields
;
col
++
)
{
...
...
@@ -448,6 +447,7 @@ static int dumpResultToFile(const char* fname, TAOS_RES* result) {
int
numOfRows
=
0
;
do
{
int32_t
*
length
=
taos_fetch_lengths
(
result
);
for
(
int
i
=
0
;
i
<
num_fields
;
i
++
)
{
if
(
i
>
0
)
{
fputc
(
','
,
fp
);
...
...
@@ -465,6 +465,39 @@ static int dumpResultToFile(const char* fname, TAOS_RES* result) {
}
static
void
shellPrintNChar
(
const
char
*
str
,
int
length
,
int
width
)
{
int
pos
=
0
,
cols
=
0
;
while
(
pos
<
length
)
{
wchar_t
wc
;
int
bytes
=
mbtowc
(
&
wc
,
str
+
pos
,
MB_CUR_MAX
);
if
(
bytes
==
0
)
{
break
;
}
pos
+=
bytes
;
if
(
pos
>
length
)
{
break
;
}
#ifdef WINDOWS
int
w
=
bytes
;
#else
int
w
=
wcwidth
(
wc
);
#endif
if
(
w
>
0
)
{
if
(
width
>
0
&&
cols
+
w
>
width
)
{
break
;
}
printf
(
"%lc"
,
wc
);
cols
+=
w
;
}
}
for
(;
cols
<
width
;
cols
++
)
{
putchar
(
' '
);
}
}
static
void
printField
(
const
char
*
val
,
TAOS_FIELD
*
field
,
int
width
,
int32_t
length
,
int
precision
)
{
if
(
val
==
NULL
)
{
int
w
=
width
;
...
...
@@ -523,7 +556,6 @@ static int verticalPrintResult(TAOS_RES* result) {
int
num_fields
=
taos_num_fields
(
result
);
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
result
);
int32_t
*
length
=
taos_fetch_lengths
(
result
);
int
precision
=
taos_result_precision
(
result
);
int
maxColNameLen
=
0
;
...
...
@@ -537,6 +569,7 @@ static int verticalPrintResult(TAOS_RES* result) {
int
numOfRows
=
0
;
do
{
printf
(
"*************************** %d.row ***************************
\n
"
,
numOfRows
+
1
);
int32_t
*
length
=
taos_fetch_lengths
(
result
);
for
(
int
i
=
0
;
i
<
num_fields
;
i
++
)
{
TAOS_FIELD
*
field
=
fields
+
i
;
...
...
@@ -631,7 +664,6 @@ static int horizontalPrintResult(TAOS_RES* result) {
int
num_fields
=
taos_num_fields
(
result
);
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
result
);
int32_t
*
length
=
taos_fetch_lengths
(
result
);
int
precision
=
taos_result_precision
(
result
);
int
width
[
TSDB_MAX_COLUMNS
];
...
...
@@ -643,6 +675,7 @@ static int horizontalPrintResult(TAOS_RES* result) {
int
numOfRows
=
0
;
do
{
int32_t
*
length
=
taos_fetch_lengths
(
result
);
for
(
int
i
=
0
;
i
<
num_fields
;
i
++
)
{
putchar
(
' '
);
printField
(
row
[
i
],
fields
+
i
,
width
[
i
],
length
[
i
],
precision
);
...
...
src/kit/shell/src/shellLinux.c
浏览文件 @
656128d9
...
...
@@ -323,30 +323,6 @@ void *shellLoopQuery(void *arg) {
return
NULL
;
}
void
shellPrintNChar
(
const
char
*
str
,
int
length
,
int
width
)
{
int
pos
=
0
,
cols
=
0
;
while
(
pos
<
length
)
{
wchar_t
wc
;
pos
+=
mbtowc
(
&
wc
,
str
+
pos
,
MB_CUR_MAX
);
if
(
pos
>
length
)
{
break
;
}
int
w
=
wcwidth
(
wc
);
if
(
w
>
0
)
{
if
(
width
>
0
&&
cols
+
w
>
width
)
{
break
;
}
printf
(
"%lc"
,
wc
);
cols
+=
w
;
}
}
for
(;
cols
<
width
;
cols
++
)
{
putchar
(
' '
);
}
}
int
get_old_terminal_mode
(
struct
termios
*
tio
)
{
/* Make sure stdin is a terminal. */
if
(
!
isatty
(
STDIN_FILENO
))
{
...
...
src/kit/shell/src/shellWindows.c
浏览文件 @
656128d9
...
...
@@ -214,32 +214,6 @@ void *shellLoopQuery(void *arg) {
return
NULL
;
}
void
shellPrintNChar
(
const
char
*
str
,
int
length
,
int
width
)
{
int
pos
=
0
,
cols
=
0
;
while
(
pos
<
length
)
{
wchar_t
wc
;
int
bytes
=
mbtowc
(
&
wc
,
str
+
pos
,
MB_CUR_MAX
);
pos
+=
bytes
;
if
(
pos
>
length
)
{
break
;
}
int
w
=
bytes
;
if
(
w
>
0
)
{
if
(
width
>
0
&&
cols
+
w
>
width
)
{
break
;
}
printf
(
"%lc"
,
wc
);
cols
+=
w
;
}
}
for
(;
cols
<
width
;
cols
++
)
{
putchar
(
' '
);
}
}
void
get_history_path
(
char
*
history
)
{
sprintf
(
history
,
"%s/%s"
,
"."
,
HISTORY_FILE
);
}
void
exitShell
()
{
exit
(
EXIT_SUCCESS
);
}
src/util/inc/tutil.h
浏览文件 @
656128d9
...
...
@@ -145,7 +145,7 @@ bool taosMbsToUcs4(char *mbs, size_t mbs_len, char *ucs4, int32_t ucs4_max_len,
int
tasoUcs4Compare
(
void
*
f1_ucs4
,
void
*
f2_ucs4
,
int
bytes
);
bool
taosUcs4ToMbs
(
void
*
ucs4
,
int32_t
ucs4_max_len
,
char
*
mbs
);
int32_t
taosUcs4ToMbs
(
void
*
ucs4
,
int32_t
ucs4_max_len
,
char
*
mbs
);
bool
taosValidateEncodec
(
const
char
*
encodec
);
...
...
src/util/src/tutil.c
浏览文件 @
656128d9
...
...
@@ -447,10 +447,10 @@ int tasoUcs4Compare(void* f1_ucs4, void *f2_ucs4, int bytes) {
int32_t ucs4_max_len = bytes + 4;
char *f1_mbs = calloc(bytes, 1);
char *f2_mbs = calloc(bytes, 1);
if (
!taosUcs4ToMbs(f1_ucs4, ucs4_max_len, f1_mbs)
) {
if (
taosUcs4ToMbs(f1_ucs4, ucs4_max_len, f1_mbs) < 0
) {
return -1;
}
if (
!taosUcs4ToMbs(f2_ucs4, ucs4_max_len, f2_mbs)
) {
if (
taosUcs4ToMbs(f2_ucs4, ucs4_max_len, f2_mbs) < 0
) {
return -1;
}
int32_t ret = strcmp(f1_mbs, f2_mbs);
...
...
@@ -464,29 +464,29 @@ int tasoUcs4Compare(void* f1_ucs4, void *f2_ucs4, int bytes) {
#endif
}
bool
taosUcs4ToMbs
(
void
*
ucs4
,
int32_t
ucs4_max_len
,
char
*
mbs
)
{
int32_t
taosUcs4ToMbs
(
void
*
ucs4
,
int32_t
ucs4_max_len
,
char
*
mbs
)
{
#ifdef USE_LIBICONV
iconv_t
cd
=
iconv_open
(
tsCharset
,
DEFAULT_UNICODE_ENCODEC
);
size_t
ucs4_input_len
=
ucs4_max_len
;
size_t
outLen
=
ucs4_max_len
;
if
(
iconv
(
cd
,
(
char
**
)
&
ucs4
,
&
ucs4_input_len
,
&
mbs
,
&
outLen
)
==
-
1
)
{
iconv_close
(
cd
);
return
false
;
return
-
1
;
}
iconv_close
(
cd
);
return
true
;
return
(
int32_t
)(
ucs4_max_len
-
outLen
)
;
#else
mbstate_t
state
=
{
0
};
int32_t
len
=
(
int32_t
)
wcsnrtombs
(
NULL
,
(
const
wchar_t
**
)
&
ucs4
,
ucs4_max_len
/
4
,
0
,
&
state
);
if
(
len
<
0
)
{
return
false
;
return
-
1
;
}
memset
(
&
state
,
0
,
sizeof
(
state
));
len
=
wcsnrtombs
(
mbs
,
(
const
wchar_t
**
)
&
ucs4
,
ucs4_max_len
/
4
,
(
size_t
)
len
,
&
state
);
if
(
len
<
0
)
{
return
false
;
return
-
1
;
}
return
true
;
return
len
;
#endif
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录