Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
39482b24
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看板
提交
39482b24
编写于
12月 02, 2022
作者:
A
Alex Duan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(shell): supported affected rows int64_t
上级
4f8c04cf
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
30 addition
and
5 deletion
+30
-5
include/client/taos.h
include/client/taos.h
+1
-0
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+2
-2
source/client/src/clientMain.c
source/client/src/clientMain.c
+12
-0
source/libs/executor/src/dataDispatcher.c
source/libs/executor/src/dataDispatcher.c
+1
-1
tools/shell/src/shellEngine.c
tools/shell/src/shellEngine.c
+14
-2
未找到文件。
include/client/taos.h
浏览文件 @
39482b24
...
...
@@ -185,6 +185,7 @@ DLL_EXPORT void taos_kill_query(TAOS *taos);
DLL_EXPORT
int
taos_field_count
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_num_fields
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_affected_rows
(
TAOS_RES
*
res
);
DLL_EXPORT
int64_t
taos_affected_rows64
(
TAOS_RES
*
res
);
DLL_EXPORT
TAOS_FIELD
*
taos_fetch_fields
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_select_db
(
TAOS
*
taos
,
const
char
*
db
);
...
...
source/client/inc/clientInt.h
浏览文件 @
39482b24
...
...
@@ -171,9 +171,9 @@ typedef struct SReqResultInfo {
char
**
convertBuf
;
TAOS_ROW
row
;
SResultColumn
*
pCol
;
uint
32
_t
numOfRows
;
uint
64
_t
numOfRows
;
uint64_t
totalRows
;
uint
32
_t
current
;
uint
64
_t
current
;
bool
localResultFetched
;
bool
completed
;
int32_t
precision
;
...
...
source/client/src/clientMain.c
浏览文件 @
39482b24
...
...
@@ -438,11 +438,23 @@ const char *taos_data_type(int type) {
const
char
*
taos_get_client_info
()
{
return
version
;
}
// return int32_t
int
taos_affected_rows
(
TAOS_RES
*
res
)
{
if
(
res
==
NULL
||
TD_RES_TMQ
(
res
)
||
TD_RES_TMQ_META
(
res
)
||
TD_RES_TMQ_METADATA
(
res
))
{
return
0
;
}
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
res
;
SReqResultInfo
*
pResInfo
=
&
pRequest
->
body
.
resInfo
;
return
(
int
)
pResInfo
->
numOfRows
;
}
// return int64_t
int64_t
taos_affected_rows
(
TAOS_RES
*
res
)
{
if
(
res
==
NULL
||
TD_RES_TMQ
(
res
)
||
TD_RES_TMQ_META
(
res
)
||
TD_RES_TMQ_METADATA
(
res
))
{
return
0
;
}
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
res
;
SReqResultInfo
*
pResInfo
=
&
pRequest
->
body
.
resInfo
;
return
pResInfo
->
numOfRows
;
...
...
source/libs/executor/src/dataDispatcher.c
浏览文件 @
39482b24
...
...
@@ -189,7 +189,7 @@ static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) {
}
SDataCacheEntry
*
pEntry
=
(
SDataCacheEntry
*
)(
pDispatcher
->
nextOutput
.
pData
);
memcpy
(
pOutput
->
pData
,
pEntry
->
data
,
pEntry
->
dataLen
);
pOutput
->
numOfRows
=
pEntry
->
numOfRows
;
pOutput
->
fr
=
pEntry
->
numOfRows
;
pOutput
->
numOfCols
=
pEntry
->
numOfCols
;
pOutput
->
compressed
=
pEntry
->
compressed
;
...
...
tools/shell/src/shellEngine.c
浏览文件 @
39482b24
...
...
@@ -214,6 +214,18 @@ void shellRunSingleCommandImp(char *command) {
return
;
}
// pre string
char
*
pre
=
"Query OK"
;
if
(
shellRegexMatch
(
command
,
"^
\\
s*delete
\\
s*from
\\
s*.*"
,
REG_EXTENDED
|
REG_ICASE
))
{
pre
=
"Deleted OK"
;
}
else
if
(
shellRegexMatch
(
command
,
"^
\\
s*insert
\\
s*into
\\
s*.*"
,
REG_EXTENDED
|
REG_ICASE
))
{
pre
=
"Inserted OK"
;
}
else
if
(
shellRegexMatch
(
command
,
"^
\\
s*create
\\
s*.*"
,
REG_EXTENDED
|
REG_ICASE
))
{
pre
=
"Created OK"
;
}
else
if
(
shellRegexMatch
(
command
,
"^
\\
s*drop
\\
s*.*"
,
REG_EXTENDED
|
REG_ICASE
))
{
pre
=
"Droped OK"
;
}
TAOS_FIELD
*
pFields
=
taos_fetch_fields
(
pSql
);
if
(
pFields
!=
NULL
)
{
// select and show kinds of commands
int32_t
error_no
=
0
;
...
...
@@ -229,10 +241,10 @@ void shellRunSingleCommandImp(char *command) {
}
taos_free_result
(
pSql
);
}
else
{
int
32_t
num_rows_affacted
=
taos_affected_rows
(
pSql
);
int
64_t
num_rows_affacted
=
taos_affected_rows64
(
pSql
);
taos_free_result
(
pSql
);
et
=
taosGetTimestampUs
();
printf
(
"
Query OK, %d
row(s) affected (%.6fs)
\r\n
"
,
num_rows_affacted
,
(
et
-
st
)
/
1E6
);
printf
(
"
%s, %"
PRId64
"
row(s) affected (%.6fs)
\r\n
"
,
num_rows_affacted
,
(
et
-
st
)
/
1E6
);
// call auto tab
callbackAutoTab
(
command
,
NULL
,
false
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录