Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Tonvia
TDengine
提交
4c185833
T
TDengine
项目概览
Tonvia
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4c185833
编写于
8月 14, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into feature/master1
上级
e87118e5
9161244c
变更
21
展开全部
隐藏空白更改
内联
并排
Showing
21 changed file
with
1127 addition
and
550 deletion
+1127
-550
.drone.yml
.drone.yml
+16
-12
deps/MsvcLibX/src/iconv.c
deps/MsvcLibX/src/iconv.c
+4
-2
deps/MsvcLibX/src/main.c
deps/MsvcLibX/src/main.c
+6
-2
deps/MsvcLibX/src/realpath.c
deps/MsvcLibX/src/realpath.c
+12
-4
src/balance/src/bnScore.c
src/balance/src/bnScore.c
+11
-2
src/client/src/tscPrepare.c
src/client/src/tscPrepare.c
+3
-2
src/client/src/tscSql.c
src/client/src/tscSql.c
+3
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+4
-0
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+9
-3
src/common/inc/tdataformat.h
src/common/inc/tdataformat.h
+6
-4
src/common/src/tdataformat.c
src/common/src/tdataformat.c
+3
-2
src/connector/nodejs/nodetaos/cinterface.js
src/connector/nodejs/nodetaos/cinterface.js
+24
-2
src/connector/nodejs/test/testnchar.js
src/connector/nodejs/test/testnchar.js
+33
-0
src/kit/shell/src/shellCheck.c
src/kit/shell/src/shellCheck.c
+3
-2
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+953
-499
src/kit/taospack/taospack.c
src/kit/taospack/taospack.c
+4
-1
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+3
-2
src/os/src/detail/osMemory.c
src/os/src/detail/osMemory.c
+3
-2
src/os/src/windows/wGetline.c
src/os/src/windows/wGetline.c
+4
-2
src/query/src/qTsbuf.c
src/query/src/qTsbuf.c
+5
-2
tests/script/general/parser/function.sim
tests/script/general/parser/function.sim
+18
-4
未找到文件。
.drone.yml
浏览文件 @
4c185833
...
@@ -15,7 +15,7 @@ steps:
...
@@ -15,7 +15,7 @@ steps:
-
mkdir debug
-
mkdir debug
-
cd debug
-
cd debug
-
cmake ..
-
cmake ..
-
make
-
make
-j4
trigger
:
trigger
:
event
:
event
:
-
pull_request
-
pull_request
...
@@ -23,6 +23,7 @@ steps:
...
@@ -23,6 +23,7 @@ steps:
branch
:
branch
:
-
develop
-
develop
-
master
-
master
-
2.0
---
---
kind
:
pipeline
kind
:
pipeline
name
:
test_arm64_bionic
name
:
test_arm64_bionic
...
@@ -39,7 +40,7 @@ steps:
...
@@ -39,7 +40,7 @@ steps:
-
mkdir debug
-
mkdir debug
-
cd debug
-
cd debug
-
cmake .. -DCPUTYPE=aarch64 > /dev/null
-
cmake .. -DCPUTYPE=aarch64 > /dev/null
-
make
-
make
-j4
trigger
:
trigger
:
event
:
event
:
-
pull_request
-
pull_request
...
@@ -66,7 +67,7 @@ steps:
...
@@ -66,7 +67,7 @@ steps:
-
mkdir debug
-
mkdir debug
-
cd debug
-
cd debug
-
cmake .. -DCPUTYPE=aarch64 > /dev/null
-
cmake .. -DCPUTYPE=aarch64 > /dev/null
-
make
-
make
-j4
trigger
:
trigger
:
event
:
event
:
-
pull_request
-
pull_request
...
@@ -91,7 +92,7 @@ steps:
...
@@ -91,7 +92,7 @@ steps:
-
mkdir debug
-
mkdir debug
-
cd debug
-
cd debug
-
cmake .. -DCPUTYPE=aarch64 > /dev/null
-
cmake .. -DCPUTYPE=aarch64 > /dev/null
-
make
-
make
-j4
trigger
:
trigger
:
event
:
event
:
-
pull_request
-
pull_request
...
@@ -116,7 +117,7 @@ steps:
...
@@ -116,7 +117,7 @@ steps:
-
mkdir debug
-
mkdir debug
-
cd debug
-
cd debug
-
cmake .. -DCPUTYPE=aarch64 > /dev/null
-
cmake .. -DCPUTYPE=aarch64 > /dev/null
-
make
-
make
-j4
trigger
:
trigger
:
event
:
event
:
-
pull_request
-
pull_request
...
@@ -142,7 +143,7 @@ steps:
...
@@ -142,7 +143,7 @@ steps:
-
mkdir debug
-
mkdir debug
-
cd debug
-
cd debug
-
cmake .. -DCPUTYPE=aarch32 > /dev/null
-
cmake .. -DCPUTYPE=aarch32 > /dev/null
-
make
-
make
-j4
trigger
:
trigger
:
event
:
event
:
-
pull_request
-
pull_request
...
@@ -150,6 +151,7 @@ steps:
...
@@ -150,6 +151,7 @@ steps:
branch
:
branch
:
-
develop
-
develop
-
master
-
master
-
2.0
---
---
kind
:
pipeline
kind
:
pipeline
name
:
build_trusty
name
:
build_trusty
...
@@ -168,7 +170,7 @@ steps:
...
@@ -168,7 +170,7 @@ steps:
-
mkdir debug
-
mkdir debug
-
cd debug
-
cd debug
-
cmake ..
-
cmake ..
-
make
-
make
-j4
trigger
:
trigger
:
event
:
event
:
-
pull_request
-
pull_request
...
@@ -176,6 +178,7 @@ steps:
...
@@ -176,6 +178,7 @@ steps:
branch
:
branch
:
-
develop
-
develop
-
master
-
master
-
2.0
---
---
kind
:
pipeline
kind
:
pipeline
name
:
build_xenial
name
:
build_xenial
...
@@ -193,7 +196,7 @@ steps:
...
@@ -193,7 +196,7 @@ steps:
-
mkdir debug
-
mkdir debug
-
cd debug
-
cd debug
-
cmake ..
-
cmake ..
-
make
-
make
-j4
trigger
:
trigger
:
event
:
event
:
-
pull_request
-
pull_request
...
@@ -201,7 +204,7 @@ steps:
...
@@ -201,7 +204,7 @@ steps:
branch
:
branch
:
-
develop
-
develop
-
master
-
master
-
2.0
---
---
kind
:
pipeline
kind
:
pipeline
name
:
build_bionic
name
:
build_bionic
...
@@ -218,7 +221,7 @@ steps:
...
@@ -218,7 +221,7 @@ steps:
-
mkdir debug
-
mkdir debug
-
cd debug
-
cd debug
-
cmake ..
-
cmake ..
-
make
-
make
-j4
trigger
:
trigger
:
event
:
event
:
-
pull_request
-
pull_request
...
@@ -226,6 +229,7 @@ steps:
...
@@ -226,6 +229,7 @@ steps:
branch
:
branch
:
-
develop
-
develop
-
master
-
master
-
2.0
---
---
kind
:
pipeline
kind
:
pipeline
name
:
build_centos7
name
:
build_centos7
...
@@ -241,7 +245,7 @@ steps:
...
@@ -241,7 +245,7 @@ steps:
-
mkdir debug
-
mkdir debug
-
cd debug
-
cd debug
-
cmake ..
-
cmake ..
-
make
-
make
-j4
trigger
:
trigger
:
event
:
event
:
-
pull_request
-
pull_request
...
@@ -249,4 +253,4 @@ steps:
...
@@ -249,4 +253,4 @@ steps:
branch
:
branch
:
-
develop
-
develop
-
master
-
master
-
2.0
\ No newline at end of file
deps/MsvcLibX/src/iconv.c
浏览文件 @
4c185833
...
@@ -98,6 +98,7 @@ int ConvertString(char *buf, size_t nBytes, UINT cpFrom, UINT cpTo, LPCSTR lpDef
...
@@ -98,6 +98,7 @@ int ConvertString(char *buf, size_t nBytes, UINT cpFrom, UINT cpTo, LPCSTR lpDef
char
*
DupAndConvert
(
const
char
*
string
,
UINT
cpFrom
,
UINT
cpTo
,
LPCSTR
lpDefaultChar
)
{
char
*
DupAndConvert
(
const
char
*
string
,
UINT
cpFrom
,
UINT
cpTo
,
LPCSTR
lpDefaultChar
)
{
int
nBytes
;
int
nBytes
;
char
*
pBuf
;
char
*
pBuf
;
char
*
pBuf1
;
nBytes
=
4
*
((
int
)
lstrlen
(
string
)
+
1
);
/* Worst case for the size needed */
nBytes
=
4
*
((
int
)
lstrlen
(
string
)
+
1
);
/* Worst case for the size needed */
pBuf
=
(
char
*
)
malloc
(
nBytes
);
pBuf
=
(
char
*
)
malloc
(
nBytes
);
if
(
!
pBuf
)
{
if
(
!
pBuf
)
{
...
@@ -110,8 +111,9 @@ char *DupAndConvert(const char *string, UINT cpFrom, UINT cpTo, LPCSTR lpDefault
...
@@ -110,8 +111,9 @@ char *DupAndConvert(const char *string, UINT cpFrom, UINT cpTo, LPCSTR lpDefault
free
(
pBuf
);
free
(
pBuf
);
return
NULL
;
return
NULL
;
}
}
pBuf
=
realloc
(
pBuf
,
nBytes
+
1
);
pBuf1
=
realloc
(
pBuf
,
nBytes
+
1
);
return
pBuf
;
if
(
pBuf1
==
NULL
&&
pBuf
!=
NULL
)
free
(
pBuf
);
return
pBuf1
;
}
}
int
CountCharacters
(
const
char
*
string
,
UINT
cp
)
{
int
CountCharacters
(
const
char
*
string
,
UINT
cp
)
{
...
...
deps/MsvcLibX/src/main.c
浏览文件 @
4c185833
...
@@ -68,6 +68,7 @@ int BreakArgLine(LPSTR pszCmdLine, char ***pppszArg) {
...
@@ -68,6 +68,7 @@ int BreakArgLine(LPSTR pszCmdLine, char ***pppszArg) {
int
iString
=
FALSE
;
/* TRUE = string mode; FALSE = non-string mode */
int
iString
=
FALSE
;
/* TRUE = string mode; FALSE = non-string mode */
int
nBackslash
=
0
;
int
nBackslash
=
0
;
char
**
ppszArg
;
char
**
ppszArg
;
char
**
ppszArg1
;
int
iArg
=
FALSE
;
/* TRUE = inside an argument; FALSE = between arguments */
int
iArg
=
FALSE
;
/* TRUE = inside an argument; FALSE = between arguments */
ppszArg
=
(
char
**
)
malloc
((
argc
+
1
)
*
sizeof
(
char
*
));
ppszArg
=
(
char
**
)
malloc
((
argc
+
1
)
*
sizeof
(
char
*
));
...
@@ -89,7 +90,10 @@ int BreakArgLine(LPSTR pszCmdLine, char ***pppszArg) {
...
@@ -89,7 +90,10 @@ int BreakArgLine(LPSTR pszCmdLine, char ***pppszArg) {
if
((
!
iArg
)
&&
(
c
!=
' '
)
&&
(
c
!=
'\t'
))
{
/* Beginning of a new argument */
if
((
!
iArg
)
&&
(
c
!=
' '
)
&&
(
c
!=
'\t'
))
{
/* Beginning of a new argument */
iArg
=
TRUE
;
iArg
=
TRUE
;
ppszArg
[
argc
++
]
=
pszCopy
+
j
;
ppszArg
[
argc
++
]
=
pszCopy
+
j
;
ppszArg
=
(
char
**
)
realloc
(
ppszArg
,
(
argc
+
1
)
*
sizeof
(
char
*
));
ppszArg1
=
(
char
**
)
realloc
(
ppszArg
,
(
argc
+
1
)
*
sizeof
(
char
*
));
if
(
ppszArg1
==
NULL
&&
ppszArg
!=
NULL
)
free
(
ppszArg
);
ppszArg
=
ppszArg1
;
if
(
!
ppszArg
)
return
-
1
;
if
(
!
ppszArg
)
return
-
1
;
pszCopy
[
j
]
=
c0
=
'\0'
;
pszCopy
[
j
]
=
c0
=
'\0'
;
}
}
...
@@ -212,7 +216,7 @@ int _initU(void) {
...
@@ -212,7 +216,7 @@ int _initU(void) {
fprintf
(
stderr
,
"Warning: Can't convert the argument line to UTF-8
\n
"
);
fprintf
(
stderr
,
"Warning: Can't convert the argument line to UTF-8
\n
"
);
_acmdln
[
0
]
=
'\0'
;
_acmdln
[
0
]
=
'\0'
;
}
}
realloc
(
_acmdln
,
n
+
1
);
/* Resize the memory block to fit the UTF-8 line */
//
realloc(_acmdln, n+1); /* Resize the memory block to fit the UTF-8 line */
/* Should not fail since we make it smaller */
/* Should not fail since we make it smaller */
/* Record the console code page, to allow converting the output accordingly */
/* Record the console code page, to allow converting the output accordingly */
...
...
deps/MsvcLibX/src/realpath.c
浏览文件 @
4c185833
...
@@ -196,6 +196,7 @@ not_compact_enough:
...
@@ -196,6 +196,7 @@ not_compact_enough:
/* Normally defined in stdlib.h. Output buf must contain PATH_MAX bytes */
/* Normally defined in stdlib.h. Output buf must contain PATH_MAX bytes */
char
*
realpath
(
const
char
*
path
,
char
*
outbuf
)
{
char
*
realpath
(
const
char
*
path
,
char
*
outbuf
)
{
char
*
pOutbuf
=
outbuf
;
char
*
pOutbuf
=
outbuf
;
char
*
pOutbuf1
;
int
iErr
;
int
iErr
;
const
char
*
pc
;
const
char
*
pc
;
...
@@ -242,8 +243,11 @@ realpath_failed:
...
@@ -242,8 +243,11 @@ realpath_failed:
return
NULL
;
return
NULL
;
}
}
if
(
!
outbuf
)
pOutbuf
=
realloc
(
pOutbuf
,
strlen
(
pOutbuf
)
+
1
);
if
(
!
outbuf
)
{
return
pOutbuf
;
pOutbuf1
=
realloc
(
pOutbuf
,
strlen
(
pOutbuf
)
+
1
);
if
(
pOutbuf1
==
NULL
&&
pOutbuf
)
free
(
pOutbuf
);
}
return
pOutbuf1
;
}
}
#endif
#endif
...
@@ -517,6 +521,7 @@ int ResolveLinksA(const char *path, char *buf, size_t bufsize) {
...
@@ -517,6 +521,7 @@ int ResolveLinksA(const char *path, char *buf, size_t bufsize) {
/* Normally defined in stdlib.h. Output buf must contain PATH_MAX bytes */
/* Normally defined in stdlib.h. Output buf must contain PATH_MAX bytes */
char
*
realpathU
(
const
char
*
path
,
char
*
outbuf
)
{
char
*
realpathU
(
const
char
*
path
,
char
*
outbuf
)
{
char
*
pOutbuf
=
outbuf
;
char
*
pOutbuf
=
outbuf
;
char
*
pOutbuf1
;
char
*
pPath1
=
NULL
;
char
*
pPath1
=
NULL
;
char
*
pPath2
=
NULL
;
char
*
pPath2
=
NULL
;
int
iErr
;
int
iErr
;
...
@@ -590,10 +595,13 @@ realpathU_failed:
...
@@ -590,10 +595,13 @@ realpathU_failed:
}
}
DEBUG_LEAVE
((
"return 0x%p; //
\"
%s
\"\n
"
,
pOutbuf
,
pOutbuf
));
DEBUG_LEAVE
((
"return 0x%p; //
\"
%s
\"\n
"
,
pOutbuf
,
pOutbuf
));
if
(
!
outbuf
)
pOutbuf
=
realloc
(
pOutbuf
,
strlen
(
pOutbuf
)
+
1
);
if
(
!
outbuf
)
{
pOutbuf1
=
realloc
(
pOutbuf
,
strlen
(
pOutbuf
)
+
1
);
if
(
pOutbuf1
==
NULL
&&
pOutbuf
)
free
(
pOutbuf
);
}
free
(
pPath1
);
free
(
pPath1
);
free
(
pPath2
);
free
(
pPath2
);
return
pOutbuf
;
return
pOutbuf
1
;
}
}
#endif
/* defined(_WIN32) */
#endif
/* defined(_WIN32) */
...
...
src/balance/src/bnScore.c
浏览文件 @
4c185833
...
@@ -116,8 +116,17 @@ void bnCleanupDnodes() {
...
@@ -116,8 +116,17 @@ void bnCleanupDnodes() {
static
void
bnCheckDnodesSize
(
int32_t
dnodesNum
)
{
static
void
bnCheckDnodesSize
(
int32_t
dnodesNum
)
{
if
(
tsBnDnodes
.
maxSize
<=
dnodesNum
)
{
if
(
tsBnDnodes
.
maxSize
<=
dnodesNum
)
{
tsBnDnodes
.
maxSize
=
dnodesNum
*
2
;
int32_t
maxSize
=
dnodesNum
*
2
;
tsBnDnodes
.
list
=
realloc
(
tsBnDnodes
.
list
,
tsBnDnodes
.
maxSize
*
sizeof
(
SDnodeObj
*
));
SDnodeObj
**
list1
=
NULL
;
int32_t
retry
=
0
;
while
(
list1
==
NULL
&&
retry
++
<
3
)
{
list1
=
realloc
(
tsBnDnodes
.
list
,
maxSize
*
sizeof
(
SDnodeObj
*
));
}
if
(
list1
)
{
tsBnDnodes
.
list
=
list1
;
tsBnDnodes
.
maxSize
=
maxSize
;
}
}
}
}
}
...
...
src/client/src/tscPrepare.c
浏览文件 @
4c185833
...
@@ -1527,8 +1527,9 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
...
@@ -1527,8 +1527,9 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
pCmd
->
insertParam
.
insertType
=
TSDB_QUERY_TYPE_STMT_INSERT
;
pCmd
->
insertParam
.
insertType
=
TSDB_QUERY_TYPE_STMT_INSERT
;
pCmd
->
insertParam
.
objectId
=
pSql
->
self
;
pCmd
->
insertParam
.
objectId
=
pSql
->
self
;
pSql
->
sqlstr
=
realloc
(
pSql
->
sqlstr
,
sqlLen
+
1
);
char
*
sqlstr
=
realloc
(
pSql
->
sqlstr
,
sqlLen
+
1
);
if
(
sqlstr
==
NULL
&&
pSql
->
sqlstr
)
free
(
pSql
->
sqlstr
);
pSql
->
sqlstr
=
sqlstr
;
if
(
pSql
->
sqlstr
==
NULL
)
{
if
(
pSql
->
sqlstr
==
NULL
)
{
tscError
(
"%p failed to malloc sql string buffer"
,
pSql
);
tscError
(
"%p failed to malloc sql string buffer"
,
pSql
);
STMT_RET
(
TSDB_CODE_TSC_OUT_OF_MEMORY
);
STMT_RET
(
TSDB_CODE_TSC_OUT_OF_MEMORY
);
...
...
src/client/src/tscSql.c
浏览文件 @
4c185833
...
@@ -887,7 +887,9 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
...
@@ -887,7 +887,9 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
return
TSDB_CODE_TSC_EXCEED_SQL_LIMIT
;
return
TSDB_CODE_TSC_EXCEED_SQL_LIMIT
;
}
}
pSql
->
sqlstr
=
realloc
(
pSql
->
sqlstr
,
sqlLen
+
1
);
char
*
sqlstr
=
realloc
(
pSql
->
sqlstr
,
sqlLen
+
1
);
if
(
sqlstr
==
NULL
&&
pSql
->
sqlstr
)
free
(
pSql
->
sqlstr
);
pSql
->
sqlstr
=
sqlstr
;
if
(
pSql
->
sqlstr
==
NULL
)
{
if
(
pSql
->
sqlstr
==
NULL
)
{
tscError
(
"0x%"
PRIx64
" failed to malloc sql string buffer"
,
pSql
->
self
);
tscError
(
"0x%"
PRIx64
" failed to malloc sql string buffer"
,
pSql
->
self
);
tfree
(
pSql
);
tfree
(
pSql
);
...
...
src/client/src/tscSubquery.c
浏览文件 @
4c185833
...
@@ -2397,6 +2397,10 @@ int32_t tscHandleFirstRoundStableQuery(SSqlObj *pSql) {
...
@@ -2397,6 +2397,10 @@ int32_t tscHandleFirstRoundStableQuery(SSqlObj *pSql) {
}
else
{
}
else
{
SSchema
ss
=
{.
type
=
(
uint8_t
)
pCol
->
info
.
type
,
.
bytes
=
pCol
->
info
.
bytes
,
.
colId
=
(
int16_t
)
pCol
->
columnIndex
};
SSchema
ss
=
{.
type
=
(
uint8_t
)
pCol
->
info
.
type
,
.
bytes
=
pCol
->
info
.
bytes
,
.
colId
=
(
int16_t
)
pCol
->
columnIndex
};
tscColumnListInsert
(
pNewQueryInfo
->
colList
,
pCol
->
columnIndex
,
pCol
->
tableUid
,
&
ss
);
tscColumnListInsert
(
pNewQueryInfo
->
colList
,
pCol
->
columnIndex
,
pCol
->
tableUid
,
&
ss
);
int32_t
ti
=
tscColumnExists
(
pNewQueryInfo
->
colList
,
pCol
->
columnIndex
,
pCol
->
tableUid
);
assert
(
ti
>=
0
);
SColumn
*
x
=
taosArrayGetP
(
pNewQueryInfo
->
colList
,
ti
);
tscColumnCopy
(
x
,
pCol
);
}
}
}
}
}
}
...
...
src/client/src/tscUtil.c
浏览文件 @
4c185833
...
@@ -625,8 +625,10 @@ static void setResRawPtrImpl(SSqlRes* pRes, SInternalField* pInfo, int32_t i, bo
...
@@ -625,8 +625,10 @@ static void setResRawPtrImpl(SSqlRes* pRes, SInternalField* pInfo, int32_t i, bo
}
else
if
(
convertNchar
&&
pInfo
->
field
.
type
==
TSDB_DATA_TYPE_NCHAR
)
{
}
else
if
(
convertNchar
&&
pInfo
->
field
.
type
==
TSDB_DATA_TYPE_NCHAR
)
{
// convert unicode to native code in a temporary buffer extra one byte for terminated symbol
// convert unicode to native code in a temporary buffer extra one byte for terminated symbol
pRes
->
buffer
[
i
]
=
realloc
(
pRes
->
buffer
[
i
],
pInfo
->
field
.
bytes
*
pRes
->
numOfRows
);
char
*
buffer
=
realloc
(
pRes
->
buffer
[
i
],
pInfo
->
field
.
bytes
*
pRes
->
numOfRows
);
if
(
buffer
==
NULL
)
return
;
pRes
->
buffer
[
i
]
=
buffer
;
// string terminated char for binary data
// string terminated char for binary data
memset
(
pRes
->
buffer
[
i
],
0
,
pInfo
->
field
.
bytes
*
pRes
->
numOfRows
);
memset
(
pRes
->
buffer
[
i
],
0
,
pInfo
->
field
.
bytes
*
pRes
->
numOfRows
);
...
@@ -4363,6 +4365,7 @@ int32_t tscCreateTableMetaFromSTableMeta(STableMeta** ppChild, const char* name,
...
@@ -4363,6 +4365,7 @@ int32_t tscCreateTableMetaFromSTableMeta(STableMeta** ppChild, const char* name,
STableMeta
*
p
=
NULL
;
STableMeta
*
p
=
NULL
;
size_t
sz
=
0
;
size_t
sz
=
0
;
STableMeta
*
pChild
=
*
ppChild
;
STableMeta
*
pChild
=
*
ppChild
;
STableMeta
*
pChild1
;
taosHashGetCloneExt
(
tscTableMetaMap
,
pChild
->
sTableName
,
strnlen
(
pChild
->
sTableName
,
TSDB_TABLE_FNAME_LEN
),
NULL
,
(
void
**
)
&
p
,
&
sz
);
taosHashGetCloneExt
(
tscTableMetaMap
,
pChild
->
sTableName
,
strnlen
(
pChild
->
sTableName
,
TSDB_TABLE_FNAME_LEN
),
NULL
,
(
void
**
)
&
p
,
&
sz
);
...
@@ -4373,7 +4376,10 @@ int32_t tscCreateTableMetaFromSTableMeta(STableMeta** ppChild, const char* name,
...
@@ -4373,7 +4376,10 @@ int32_t tscCreateTableMetaFromSTableMeta(STableMeta** ppChild, const char* name,
int32_t
totalBytes
=
(
p
->
tableInfo
.
numOfColumns
+
p
->
tableInfo
.
numOfTags
)
*
sizeof
(
SSchema
);
int32_t
totalBytes
=
(
p
->
tableInfo
.
numOfColumns
+
p
->
tableInfo
.
numOfTags
)
*
sizeof
(
SSchema
);
int32_t
tableMetaSize
=
sizeof
(
STableMeta
)
+
totalBytes
;
int32_t
tableMetaSize
=
sizeof
(
STableMeta
)
+
totalBytes
;
if
(
*
tableMetaCapacity
<
tableMetaSize
)
{
if
(
*
tableMetaCapacity
<
tableMetaSize
)
{
pChild
=
realloc
(
pChild
,
tableMetaSize
);
pChild1
=
realloc
(
pChild
,
tableMetaSize
);
if
(
pChild1
==
NULL
)
return
-
1
;
pChild
=
pChild1
;
*
tableMetaCapacity
=
(
size_t
)
tableMetaSize
;
*
tableMetaCapacity
=
(
size_t
)
tableMetaSize
;
}
}
...
...
src/common/inc/tdataformat.h
浏览文件 @
4c185833
...
@@ -547,8 +547,9 @@ SKVRow tdGetKVRowFromBuilder(SKVRowBuilder *pBuilder);
...
@@ -547,8 +547,9 @@ SKVRow tdGetKVRowFromBuilder(SKVRowBuilder *pBuilder);
static
FORCE_INLINE
int
tdAddColToKVRow
(
SKVRowBuilder
*
pBuilder
,
int16_t
colId
,
int8_t
type
,
void
*
value
)
{
static
FORCE_INLINE
int
tdAddColToKVRow
(
SKVRowBuilder
*
pBuilder
,
int16_t
colId
,
int8_t
type
,
void
*
value
)
{
if
(
pBuilder
->
nCols
>=
pBuilder
->
tCols
)
{
if
(
pBuilder
->
nCols
>=
pBuilder
->
tCols
)
{
pBuilder
->
tCols
*=
2
;
pBuilder
->
tCols
*=
2
;
pBuilder
->
pColIdx
=
(
SColIdx
*
)
realloc
((
void
*
)(
pBuilder
->
pColIdx
),
sizeof
(
SColIdx
)
*
pBuilder
->
tCols
);
SColIdx
*
pColIdx
=
(
SColIdx
*
)
realloc
((
void
*
)(
pBuilder
->
pColIdx
),
sizeof
(
SColIdx
)
*
pBuilder
->
tCols
);
if
(
pBuilder
->
pColIdx
==
NULL
)
return
-
1
;
if
(
pColIdx
==
NULL
)
return
-
1
;
pBuilder
->
pColIdx
=
pColIdx
;
}
}
pBuilder
->
pColIdx
[
pBuilder
->
nCols
].
colId
=
colId
;
pBuilder
->
pColIdx
[
pBuilder
->
nCols
].
colId
=
colId
;
...
@@ -561,8 +562,9 @@ static FORCE_INLINE int tdAddColToKVRow(SKVRowBuilder *pBuilder, int16_t colId,
...
@@ -561,8 +562,9 @@ static FORCE_INLINE int tdAddColToKVRow(SKVRowBuilder *pBuilder, int16_t colId,
while
(
tlen
>
pBuilder
->
alloc
-
pBuilder
->
size
)
{
while
(
tlen
>
pBuilder
->
alloc
-
pBuilder
->
size
)
{
pBuilder
->
alloc
*=
2
;
pBuilder
->
alloc
*=
2
;
}
}
pBuilder
->
buf
=
realloc
(
pBuilder
->
buf
,
pBuilder
->
alloc
);
void
*
buf
=
realloc
(
pBuilder
->
buf
,
pBuilder
->
alloc
);
if
(
pBuilder
->
buf
==
NULL
)
return
-
1
;
if
(
buf
==
NULL
)
return
-
1
;
pBuilder
->
buf
=
buf
;
}
}
memcpy
(
POINTER_SHIFT
(
pBuilder
->
buf
,
pBuilder
->
size
),
value
,
tlen
);
memcpy
(
POINTER_SHIFT
(
pBuilder
->
buf
,
pBuilder
->
size
),
value
,
tlen
);
...
...
src/common/src/tdataformat.c
浏览文件 @
4c185833
...
@@ -138,8 +138,9 @@ int tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int16_t colId, int1
...
@@ -138,8 +138,9 @@ int tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int16_t colId, int1
if
(
pBuilder
->
nCols
>=
pBuilder
->
tCols
)
{
if
(
pBuilder
->
nCols
>=
pBuilder
->
tCols
)
{
pBuilder
->
tCols
*=
2
;
pBuilder
->
tCols
*=
2
;
pBuilder
->
columns
=
(
STColumn
*
)
realloc
(
pBuilder
->
columns
,
sizeof
(
STColumn
)
*
pBuilder
->
tCols
);
STColumn
*
columns
=
(
STColumn
*
)
realloc
(
pBuilder
->
columns
,
sizeof
(
STColumn
)
*
pBuilder
->
tCols
);
if
(
pBuilder
->
columns
==
NULL
)
return
-
1
;
if
(
columns
==
NULL
)
return
-
1
;
pBuilder
->
columns
=
columns
;
}
}
STColumn
*
pCol
=
&
(
pBuilder
->
columns
[
pBuilder
->
nCols
]);
STColumn
*
pCol
=
&
(
pBuilder
->
columns
[
pBuilder
->
nCols
]);
...
...
src/connector/nodejs/nodetaos/cinterface.js
浏览文件 @
4c185833
...
@@ -109,6 +109,24 @@ function convertDouble(data, num_of_rows, nbytes = 0, offset = 0, precision = 0)
...
@@ -109,6 +109,24 @@ function convertDouble(data, num_of_rows, nbytes = 0, offset = 0, precision = 0)
return
res
;
return
res
;
}
}
function
convertBinary
(
data
,
num_of_rows
,
nbytes
=
0
,
offset
=
0
,
precision
=
0
)
{
data
=
ref
.
reinterpret
(
data
.
deref
(),
nbytes
*
num_of_rows
,
offset
);
let
res
=
[];
let
currOffset
=
0
;
while
(
currOffset
<
data
.
length
)
{
let
len
=
data
.
readIntLE
(
currOffset
,
2
);
let
dataEntry
=
data
.
slice
(
currOffset
+
2
,
currOffset
+
len
+
2
);
//one entry in a row under a column;
if
(
dataEntry
[
0
]
==
255
)
{
res
.
push
(
null
)
}
else
{
res
.
push
(
dataEntry
.
toString
(
"
utf-8
"
));
}
currOffset
+=
nbytes
;
}
return
res
;
}
function
convertNchar
(
data
,
num_of_rows
,
nbytes
=
0
,
offset
=
0
,
precision
=
0
)
{
function
convertNchar
(
data
,
num_of_rows
,
nbytes
=
0
,
offset
=
0
,
precision
=
0
)
{
data
=
ref
.
reinterpret
(
data
.
deref
(),
nbytes
*
num_of_rows
,
offset
);
data
=
ref
.
reinterpret
(
data
.
deref
(),
nbytes
*
num_of_rows
,
offset
);
let
res
=
[];
let
res
=
[];
...
@@ -117,7 +135,11 @@ function convertNchar(data, num_of_rows, nbytes = 0, offset = 0, precision = 0)
...
@@ -117,7 +135,11 @@ function convertNchar(data, num_of_rows, nbytes = 0, offset = 0, precision = 0)
while
(
currOffset
<
data
.
length
)
{
while
(
currOffset
<
data
.
length
)
{
let
len
=
data
.
readIntLE
(
currOffset
,
2
);
let
len
=
data
.
readIntLE
(
currOffset
,
2
);
let
dataEntry
=
data
.
slice
(
currOffset
+
2
,
currOffset
+
len
+
2
);
//one entry in a row under a column;
let
dataEntry
=
data
.
slice
(
currOffset
+
2
,
currOffset
+
len
+
2
);
//one entry in a row under a column;
res
.
push
(
dataEntry
.
toString
(
"
utf-8
"
));
if
(
dataEntry
[
0
]
==
255
&&
dataEntry
[
1
]
==
255
)
{
res
.
push
(
null
)
}
else
{
res
.
push
(
dataEntry
.
toString
(
"
utf-8
"
));
}
currOffset
+=
nbytes
;
currOffset
+=
nbytes
;
}
}
return
res
;
return
res
;
...
@@ -132,7 +154,7 @@ let convertFunctions = {
...
@@ -132,7 +154,7 @@ let convertFunctions = {
[
FieldTypes
.
C_BIGINT
]:
convertBigint
,
[
FieldTypes
.
C_BIGINT
]:
convertBigint
,
[
FieldTypes
.
C_FLOAT
]:
convertFloat
,
[
FieldTypes
.
C_FLOAT
]:
convertFloat
,
[
FieldTypes
.
C_DOUBLE
]:
convertDouble
,
[
FieldTypes
.
C_DOUBLE
]:
convertDouble
,
[
FieldTypes
.
C_BINARY
]:
convert
Nchar
,
[
FieldTypes
.
C_BINARY
]:
convert
Binary
,
[
FieldTypes
.
C_TIMESTAMP
]:
convertTimestamp
,
[
FieldTypes
.
C_TIMESTAMP
]:
convertTimestamp
,
[
FieldTypes
.
C_NCHAR
]:
convertNchar
[
FieldTypes
.
C_NCHAR
]:
convertNchar
}
}
...
...
src/connector/nodejs/test/testnchar.js
0 → 100644
浏览文件 @
4c185833
const
taos
=
require
(
'
../tdengine
'
);
var
conn
=
taos
.
connect
({
host
:
"
localhost
"
});
var
c1
=
conn
.
cursor
();
function
checkData
(
data
,
row
,
col
,
expect
)
{
let
checkdata
=
data
[
row
][
col
];
if
(
checkdata
==
expect
)
{
// console.log('check pass')
}
else
{
console
.
log
(
'
check failed, expect
'
+
expect
+
'
, but is
'
+
checkdata
)
}
}
c1
.
execute
(
'
drop database if exists testnodejsnchar
'
)
c1
.
execute
(
'
create database testnodejsnchar
'
)
c1
.
execute
(
'
use testnodejsnchar
'
);
c1
.
execute
(
'
create table tb (ts timestamp, value float, text binary(200))
'
)
c1
.
execute
(
"
insert into tb values('2021-06-10 00:00:00', 24.7, '中文10000000000000000000000');
"
)
-
c1
.
execute
(
'
insert into tb values(1623254400150, 24.7, NULL);
'
)
c1
.
execute
(
'
import into tb values(1623254400300, 24.7, "中文3中文10000000000000000000000中文10000000000000000000000中文10000000000000000000000中文10000000000000000000000");
'
)
sql
=
'
select * from tb;
'
console
.
log
(
'
*******************************************
'
)
c1
.
execute
(
sql
);
data
=
c1
.
fetchall
();
console
.
log
(
data
)
//check data about insert data
checkData
(
data
,
0
,
2
,
'
中文10000000000000000000000
'
)
checkData
(
data
,
1
,
2
,
null
)
checkData
(
data
,
2
,
2
,
'
中文3中文10000000000000000000000中文10000000000000000000000中文10000000000000000000000中文10000000000000000000000
'
)
\ No newline at end of file
src/kit/shell/src/shellCheck.c
浏览文件 @
4c185833
...
@@ -72,12 +72,13 @@ static int32_t shellShowTables(TAOS *con, char *db) {
...
@@ -72,12 +72,13 @@ static int32_t shellShowTables(TAOS *con, char *db) {
int32_t
tbIndex
=
tbNum
++
;
int32_t
tbIndex
=
tbNum
++
;
if
(
tbMallocNum
<
tbNum
)
{
if
(
tbMallocNum
<
tbNum
)
{
tbMallocNum
=
(
tbMallocNum
*
2
+
1
);
tbMallocNum
=
(
tbMallocNum
*
2
+
1
);
tbNames
=
realloc
(
tbNames
,
tbMallocNum
*
sizeof
(
char
*
));
char
**
tbNames1
=
realloc
(
tbNames
,
tbMallocNum
*
sizeof
(
char
*
));
if
(
tbNames
==
NULL
)
{
if
(
tbNames
1
==
NULL
)
{
fprintf
(
stdout
,
"failed to malloc tablenames, num:%d
\n
"
,
tbMallocNum
);
fprintf
(
stdout
,
"failed to malloc tablenames, num:%d
\n
"
,
tbMallocNum
);
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
break
;
break
;
}
}
tbNames
=
tbNames1
;
}
}
tbNames
[
tbIndex
]
=
malloc
(
TSDB_TABLE_NAME_LEN
);
tbNames
[
tbIndex
]
=
malloc
(
TSDB_TABLE_NAME_LEN
);
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
4c185833
此差异已折叠。
点击以展开。
src/kit/taospack/taospack.c
浏览文件 @
4c185833
...
@@ -149,7 +149,10 @@ float* read_float(const char* inFile, int* pcount){
...
@@ -149,7 +149,10 @@ float* read_float(const char* inFile, int* pcount){
//printf(" buff=%s float=%.50f \n ", buf, floats[fi]);
//printf(" buff=%s float=%.50f \n ", buf, floats[fi]);
if
(
++
fi
==
malloc_cnt
)
{
if
(
++
fi
==
malloc_cnt
)
{
malloc_cnt
+=
100000
;
malloc_cnt
+=
100000
;
floats
=
realloc
(
floats
,
malloc_cnt
*
sizeof
(
float
));
float
*
floats1
=
realloc
(
floats
,
malloc_cnt
*
sizeof
(
float
));
if
(
floats1
==
NULL
)
break
;
floats
=
floats1
;
}
}
memset
(
buf
,
0
,
sizeof
(
buf
));
memset
(
buf
,
0
,
sizeof
(
buf
));
}
}
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
4c185833
...
@@ -2921,10 +2921,11 @@ static SMultiTableMeta* ensureMsgBufferSpace(SMultiTableMeta *pMultiMeta, SArray
...
@@ -2921,10 +2921,11 @@ static SMultiTableMeta* ensureMsgBufferSpace(SMultiTableMeta *pMultiMeta, SArray
(
*
totalMallocLen
)
*=
2
;
(
*
totalMallocLen
)
*=
2
;
}
}
pMultiMeta
=
realloc
(
pMultiMeta
,
*
totalMallocLen
);
SMultiTableMeta
*
pMultiMeta1
=
realloc
(
pMultiMeta
,
*
totalMallocLen
);
if
(
pMultiMeta
==
NULL
)
{
if
(
pMultiMeta
1
==
NULL
)
{
return
NULL
;
return
NULL
;
}
}
pMultiMeta
=
pMultiMeta1
;
}
}
return
pMultiMeta
;
return
pMultiMeta
;
...
...
src/os/src/detail/osMemory.c
浏览文件 @
4c185833
...
@@ -504,8 +504,9 @@ void * taosTRealloc(void *ptr, size_t size) {
...
@@ -504,8 +504,9 @@ void * taosTRealloc(void *ptr, size_t size) {
void
*
tptr
=
(
void
*
)((
char
*
)
ptr
-
sizeof
(
size_t
));
void
*
tptr
=
(
void
*
)((
char
*
)
ptr
-
sizeof
(
size_t
));
size_t
tsize
=
size
+
sizeof
(
size_t
);
size_t
tsize
=
size
+
sizeof
(
size_t
);
tptr
=
realloc
(
tptr
,
tsize
);
void
*
tptr1
=
realloc
(
tptr
,
tsize
);
if
(
tptr
==
NULL
)
return
NULL
;
if
(
tptr1
==
NULL
)
return
NULL
;
tptr
=
tptr1
;
*
(
size_t
*
)
tptr
=
size
;
*
(
size_t
*
)
tptr
=
size
;
...
...
src/os/src/windows/wGetline.c
浏览文件 @
4c185833
...
@@ -81,11 +81,13 @@ int32_t getstr(char **lineptr, size_t *n, FILE *stream, char terminator, int32_t
...
@@ -81,11 +81,13 @@ int32_t getstr(char **lineptr, size_t *n, FILE *stream, char terminator, int32_t
*
n
+=
MIN_CHUNK
;
*
n
+=
MIN_CHUNK
;
nchars_avail
=
(
int32_t
)(
*
n
+
*
lineptr
-
read_pos
);
nchars_avail
=
(
int32_t
)(
*
n
+
*
lineptr
-
read_pos
);
*
lineptr
=
realloc
(
*
lineptr
,
*
n
);
char
*
lineptr1
=
realloc
(
*
lineptr
,
*
n
);
if
(
!
*
lineptr
)
{
if
(
!
lineptr1
)
{
errno
=
ENOMEM
;
errno
=
ENOMEM
;
return
-
1
;
return
-
1
;
}
}
*
lineptr
=
lineptr1
;
read_pos
=
*
n
-
nchars_avail
+
*
lineptr
;
read_pos
=
*
n
-
nchars_avail
+
*
lineptr
;
assert
((
*
lineptr
+
*
n
)
==
(
read_pos
+
nchars_avail
));
assert
((
*
lineptr
+
*
n
)
==
(
read_pos
+
nchars_avail
));
}
}
...
...
src/query/src/qTsbuf.c
浏览文件 @
4c185833
...
@@ -223,8 +223,11 @@ static STSGroupBlockInfoEx* addOneGroupInfo(STSBuf* pTSBuf, int32_t id) {
...
@@ -223,8 +223,11 @@ static STSGroupBlockInfoEx* addOneGroupInfo(STSBuf* pTSBuf, int32_t id) {
static
void
shrinkBuffer
(
STSList
*
ptsData
)
{
static
void
shrinkBuffer
(
STSList
*
ptsData
)
{
// shrink tmp buffer size if it consumes too many memory compared to the pre-defined size
// shrink tmp buffer size if it consumes too many memory compared to the pre-defined size
if
(
ptsData
->
allocSize
>=
ptsData
->
threshold
*
2
)
{
if
(
ptsData
->
allocSize
>=
ptsData
->
threshold
*
2
)
{
ptsData
->
rawBuf
=
realloc
(
ptsData
->
rawBuf
,
MEM_BUF_SIZE
);
char
*
rawBuf
=
realloc
(
ptsData
->
rawBuf
,
MEM_BUF_SIZE
);
ptsData
->
allocSize
=
MEM_BUF_SIZE
;
if
(
rawBuf
)
{
ptsData
->
rawBuf
=
rawBuf
;
ptsData
->
allocSize
=
MEM_BUF_SIZE
;
}
}
}
}
}
...
...
tests/script/general/parser/function.sim
浏览文件 @
4c185833
...
@@ -1149,9 +1149,11 @@ endi
...
@@ -1149,9 +1149,11 @@ endi
sql select derivative(test_column_alias_name, 1s, 0) from (select avg(k) test_column_alias_name from t1 interval(1s));
sql select derivative(test_column_alias_name, 1s, 0) from (select avg(k) test_column_alias_name from t1 interval(1s));
sql create table smeters (ts timestamp, current float, voltage int);
sql create table smeters (ts timestamp, current float, voltage int) tags (t1 int);
sql insert into smeters values ('2021-08-08 10:10:10', 10, 1);
sql create table smeter1 using smeters tags (1);
sql insert into smeters values ('2021-08-08 10:10:12', 10, 2);
sql insert into smeter1 values ('2021-08-08 10:10:10', 10, 2);
sql insert into smeter1 values ('2021-08-08 10:10:12', 10, 2);
sql insert into smeter1 values ('2021-08-08 10:10:14', 20, 1);
sql select stddev(voltage) from smeters where ts>='2021-08-08 10:10:10.000' and ts < '2021-08-08 10:10:20.000' and current=10 interval(1000a);
sql select stddev(voltage) from smeters where ts>='2021-08-08 10:10:10.000' and ts < '2021-08-08 10:10:20.000' and current=10 interval(1000a);
if $rows != 2 then
if $rows != 2 then
...
@@ -1160,9 +1162,21 @@ endi
...
@@ -1160,9 +1162,21 @@ endi
if $data00 != @21-08-08 10:10:10.000@ then
if $data00 != @21-08-08 10:10:10.000@ then
return -1
return -1
endi
endi
if $data01 != 0.000000000 then
return -1
endi
if $data10 != @21-08-08 10:10:12.000@ then
if $data10 != @21-08-08 10:10:12.000@ then
return -1
return -1
endi
endi
if $data11 != 0.000000000 then
return -1
endi
sql select stddev(voltage) from smeters where ts>='2021-08-08 10:10:10.000' and ts < '2021-08-08 10:10:20.000' and current=10;
if $rows != 1 then
return -1
endi
if $data00 != 0.000000000 then
return -1
endi
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录