Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8add9a9a
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
8add9a9a
编写于
5月 19, 2022
作者:
wafwerar
提交者:
GitHub
5月 19, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12682 from taosdata/fix/ZhiqiangWang/fix-15602-fix-win-run-error
fix(os): win run error
上级
76567312
f1a788f1
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
215 addition
and
84 deletion
+215
-84
cmake/cmake.install
cmake/cmake.install
+13
-8
include/os/osString.h
include/os/osString.h
+18
-0
packaging/tools/make_install.bat
packaging/tools/make_install.bat
+6
-0
source/client/src/clientSml.c
source/client/src/clientSml.c
+2
-2
source/common/src/tname.c
source/common/src/tname.c
+1
-1
source/common/src/ttime.c
source/common/src/ttime.c
+2
-2
source/common/src/tvariant.c
source/common/src/tvariant.c
+4
-4
source/libs/index/src/indexComm.c
source/libs/index/src/indexComm.c
+4
-4
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+28
-28
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+3
-3
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+11
-11
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+1
-1
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+4
-4
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+11
-11
source/os/CMakeLists.txt
source/os/CMakeLists.txt
+3
-0
source/os/src/osString.c
source/os/src/osString.c
+99
-0
source/util/src/tjson.c
source/util/src/tjson.c
+2
-2
tools/shell/src/shellEngine.c
tools/shell/src/shellEngine.c
+3
-3
未找到文件。
cmake/cmake.install
浏览文件 @
8add9a9a
...
...
@@ -5,22 +5,27 @@ IF (TD_LINUX)
ELSEIF
(
TD_WINDOWS
)
SET
(
CMAKE_INSTALL_PREFIX
C
:/
TDengine
)
INSTALL
(
DIRECTORY
$
{
TD_SOURCE_DIR
}
/
src
/
connector
/
go
DESTINATION
connector
)
INSTALL
(
DIRECTORY
$
{
TD_SOURCE_DIR
}
/
src
/
connector
/
nodejs
DESTINATION
connector
)
INSTALL
(
DIRECTORY
$
{
TD_SOURCE_DIR
}
/
src
/
connector
/
python
DESTINATION
connector
)
INSTALL
(
DIRECTORY
$
{
TD_SOURCE_DIR
}
/
src
/
connector
/
C
\
# DESTINATION connector)
INSTALL
(
DIRECTORY
$
{
TD_SOURCE_DIR
}
/
examples
DESTINATION
.
)
#
INSTALL(DIRECTORY ${TD_SOURCE_DIR}/src/connector/go DESTINATION connector)
#
INSTALL(DIRECTORY ${TD_SOURCE_DIR}/src/connector/nodejs DESTINATION connector)
#
INSTALL(DIRECTORY ${TD_SOURCE_DIR}/src/connector/python DESTINATION connector)
#
INSTALL(DIRECTORY ${TD_SOURCE_DIR}/src/connector/C\# DESTINATION connector)
#
INSTALL(DIRECTORY ${TD_SOURCE_DIR}/examples DESTINATION .)
INSTALL
(
FILES
$
{
TD_SOURCE_DIR
}
/
packaging
/
cfg
/
taos
.
cfg
DESTINATION
cfg
)
INSTALL
(
FILES
$
{
TD_SOURCE_DIR
}
/
src
/
inc
/
taos
.
h
DESTINATION
include
)
INSTALL
(
FILES
$
{
TD_SOURCE_DIR
}
/
src
/
inc
/
taoserror
.
h
DESTINATION
include
)
INSTALL
(
FILES
$
{
TD_SOURCE_DIR
}
/
include
/
client
/
taos
.
h
DESTINATION
include
)
INSTALL
(
FILES
$
{
TD_SOURCE_DIR
}
/
include
/
util
/
taoserror
.
h
DESTINATION
include
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
.
lib
DESTINATION
driver
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos_static
.
lib
DESTINATION
driver
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
.
exp
DESTINATION
driver
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
.
dll
DESTINATION
driver
)
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
taos
.
exe
DESTINATION
.
)
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
taosd
.
exe
DESTINATION
.
)
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
udfd
.
exe
DESTINATION
.
)
IF
(
TD_MVN_INSTALLED
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
-
jdbcdriver
-
2.0.38
-
dist
.
jar
DESTINATION
connector
/
jdbc
)
ENDIF
()
SET
(
TD_MAKE_INSTALL_SH
"${TD_SOURCE_DIR}/packaging/tools/make_install.bat"
)
INSTALL
(
CODE
"MESSAGE(
\"
make install script: ${TD_MAKE_INSTALL_SH}
\"
)"
)
INSTALL
(
CODE
"execute_process(COMMAND ${TD_MAKE_INSTALL_SH} :needAdmin ${TD_SOURCE_DIR} ${PROJECT_BINARY_DIR} Windows ${TD_VER_NUMBER})"
)
ELSEIF
(
TD_DARWIN
)
SET
(
TD_MAKE_INSTALL_SH
"${TD_SOURCE_DIR}/packaging/tools/make_install.sh"
)
INSTALL
(
CODE
"MESSAGE(
\"
make install script: ${TD_MAKE_INSTALL_SH}
\"
)"
)
...
...
include/os/osString.h
浏览文件 @
8add9a9a
...
...
@@ -38,6 +38,13 @@ typedef int32_t TdUcs4;
#define wcsncpy WCSNCPY_FUNC_TAOS_FORBID
#define wchar_t WCHAR_T_TYPE_TAOS_FORBID
#define strcasestr STR_CASE_STR_FORBID
#define strtoll STR_TO_LL_FUNC_TAOS_FORBID
#define strtoull STR_TO_ULL_FUNC_TAOS_FORBID
#define strtol STR_TO_L_FUNC_TAOS_FORBID
#define strtoul STR_TO_UL_FUNC_TAOS_FORBID
#define strtod STR_TO_LD_FUNC_TAOS_FORBID
#define strtold STR_TO_D_FUNC_TAOS_FORBID
#define strtof STR_TO_F_FUNC_TAOS_FORBID
#endif
#ifdef WINDOWS
...
...
@@ -72,6 +79,17 @@ int32_t taosWcharsToMbs(char *pStrs, TdWchar *pWchars, int32_t size);
char
*
taosStrCaseStr
(
const
char
*
str
,
const
char
*
pattern
);
int64_t
taosStr2Int64
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
uint64_t
taosStr2UInt64
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
int32_t
taosStr2Int32
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
uint32_t
taosStr2UInt32
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
int16_t
taosStr2Int16
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
uint16_t
taosStr2UInt16
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
int8_t
taosStr2Int8
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
uint8_t
taosStr2UInt8
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
);
double
taosStr2Double
(
const
char
*
str
,
char
**
pEnd
);
float
taosStr2Float
(
const
char
*
str
,
char
**
pEnd
);
#ifdef __cplusplus
}
#endif
...
...
packaging/tools/make_install.bat
0 → 100644
浏览文件 @
8add9a9a
@echo
off
goto
%
1
:needAdmin
mshta
vbscript
:createobject
(
"shell.application"
)
.shellexecute
(
"
%~s0
"
,
":hasAdmin"
,
""
,
"runas"
,
1
)(
window
.close
)&
goto
:eof
:hasAdmin
cp
-f
C
:\\TDengine\\driver\\taos.dll
C
:\\Windows\\System32
\ No newline at end of file
source/client/src/clientSml.c
浏览文件 @
8add9a9a
...
...
@@ -580,7 +580,7 @@ static bool smlParseNumber(SSmlKv *kvVal, SSmlMsgBuf *msg){
const
char
*
pVal
=
kvVal
->
value
;
int32_t
len
=
kvVal
->
length
;
char
*
endptr
=
NULL
;
double
result
=
strtod
(
pVal
,
&
endptr
);
double
result
=
taosStr2Double
(
pVal
,
&
endptr
);
if
(
pVal
==
endptr
){
smlBuildInvalidDataMsg
(
msg
,
"invalid data"
,
pVal
);
return
false
;
...
...
@@ -714,7 +714,7 @@ static bool smlIsNchar(const char *pVal, uint16_t len) {
static
int64_t
smlGetTimeValue
(
const
char
*
value
,
int32_t
len
,
int8_t
type
)
{
char
*
endPtr
=
NULL
;
int64_t
tsInt64
=
strtoll
(
value
,
&
endPtr
,
10
);
int64_t
tsInt64
=
taosStr2Int64
(
value
,
&
endPtr
,
10
);
if
(
value
+
len
!=
endPtr
){
return
-
1
;
}
...
...
source/common/src/tname.c
浏览文件 @
8add9a9a
...
...
@@ -250,7 +250,7 @@ int32_t tNameFromString(SName* dst, const char* str, uint32_t type) {
return
-
1
;
}
dst
->
acctId
=
strtoll
(
str
,
NULL
,
10
);
dst
->
acctId
=
taosStr2Int32
(
str
,
NULL
,
10
);
}
if
((
type
&
T_NAME_DB
)
==
T_NAME_DB
)
{
...
...
source/common/src/ttime.c
浏览文件 @
8add9a9a
...
...
@@ -590,7 +590,7 @@ int32_t parseAbsoluteDuration(const char* token, int32_t tokenlen, int64_t* dura
char
*
endPtr
=
NULL
;
/* get the basic numeric value */
int64_t
timestamp
=
strtoll
(
token
,
&
endPtr
,
10
);
int64_t
timestamp
=
taosStr2Int64
(
token
,
&
endPtr
,
10
);
if
(
errno
!=
0
)
{
return
-
1
;
}
...
...
@@ -608,7 +608,7 @@ int32_t parseNatualDuration(const char* token, int32_t tokenLen, int64_t* durati
errno
=
0
;
/* get the basic numeric value */
*
duration
=
strtoll
(
token
,
NULL
,
10
);
*
duration
=
taosStr2Int64
(
token
,
NULL
,
10
);
if
(
errno
!=
0
)
{
return
-
1
;
}
...
...
source/common/src/tvariant.c
浏览文件 @
8add9a9a
...
...
@@ -39,7 +39,7 @@ int32_t toInteger(const char *z, int32_t n, int32_t base, int64_t *value) {
errno
=
0
;
char
*
endPtr
=
NULL
;
*
value
=
strtoll
(
z
,
&
endPtr
,
base
);
*
value
=
taosStr2Int64
(
z
,
&
endPtr
,
base
);
if
(
errno
==
ERANGE
||
errno
==
EINVAL
||
endPtr
-
z
!=
n
)
{
errno
=
0
;
return
-
1
;
...
...
@@ -58,7 +58,7 @@ int32_t toUInteger(const char *z, int32_t n, int32_t base, uint64_t *value) {
return
-
1
;
}
*
value
=
strtoull
(
z
,
&
endPtr
,
base
);
*
value
=
taosStr2UInt64
(
z
,
&
endPtr
,
base
);
if
(
errno
==
ERANGE
||
errno
==
EINVAL
||
endPtr
-
z
!=
n
)
{
errno
=
0
;
return
-
1
;
...
...
@@ -434,7 +434,7 @@ static FORCE_INLINE int32_t convertToDouble(char *pStr, int32_t len, double *val
// return -1;
// }
//
// *value =
strtod
(pStr, NULL);
// *value =
taosStr2Double
(pStr, NULL);
return
0
;
}
...
...
@@ -911,7 +911,7 @@ int32_t taosVariantTypeSetType(SVariant *pVariant, char type) {
case
TSDB_DATA_TYPE_DOUBLE
:
{
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_BINARY
)
{
errno
=
0
;
double
v
=
strtod
(
pVariant
->
pz
,
NULL
);
double
v
=
taosStr2Double
(
pVariant
->
pz
,
NULL
);
if
((
errno
==
ERANGE
&&
v
==
-
1
)
||
(
isinf
(
v
)
||
isnan
(
v
)))
{
taosMemoryFree
(
pVariant
->
pz
);
return
-
1
;
...
...
source/libs/index/src/indexComm.c
浏览文件 @
8add9a9a
...
...
@@ -118,21 +118,21 @@ TExeCond tCompare(__compar_fn_t func, int8_t cmptype, void* a, void* b, int8_t d
}
return
tDoCompare
(
func
,
cmptype
,
&
va
,
&
vb
);
}
else
if
(
dtype
==
TSDB_DATA_TYPE_FLOAT
)
{
float
va
=
strtod
(
a
,
NULL
);
float
va
=
taosStr2Float
(
a
,
NULL
);
if
(
errno
==
ERANGE
&&
va
==
-
1
)
{
return
CONTINUE
;
}
float
vb
=
strtod
(
b
,
NULL
);
float
vb
=
taosStr2Float
(
b
,
NULL
);
if
(
errno
==
ERANGE
&&
va
==
-
1
)
{
return
CONTINUE
;
}
return
tDoCompare
(
func
,
cmptype
,
&
va
,
&
vb
);
}
else
if
(
dtype
==
TSDB_DATA_TYPE_DOUBLE
)
{
double
va
=
strtod
(
a
,
NULL
);
double
va
=
taosStr2Double
(
a
,
NULL
);
if
(
errno
==
ERANGE
&&
va
==
-
1
)
{
return
CONTINUE
;
}
double
vb
=
strtod
(
b
,
NULL
);
double
vb
=
taosStr2Double
(
b
,
NULL
);
if
(
errno
==
ERANGE
&&
va
==
-
1
)
{
return
CONTINUE
;
}
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
8add9a9a
...
...
@@ -123,7 +123,7 @@ static bool checkAndSplitEndpoint(SAstCreateContext* pCxt, const SToken* pEp, ch
pCxt
->
errCode
=
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_ENDPOINT
);
}
else
{
strncpy
(
pFqdn
,
ep
,
pColon
-
ep
);
*
pPort
=
strtol
(
pColon
+
1
,
NULL
,
10
);
*
pPort
=
taosStr2Int32
(
pColon
+
1
,
NULL
,
10
);
if
(
*
pPort
>=
UINT16_MAX
||
*
pPort
<=
0
)
{
pCxt
->
errCode
=
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_PORT
);
}
...
...
@@ -147,7 +147,7 @@ static bool checkPort(SAstCreateContext* pCxt, const SToken* pPortToken, int32_t
if
(
NULL
==
pPortToken
)
{
pCxt
->
errCode
=
TSDB_CODE_PAR_SYNTAX_ERROR
;
}
else
{
*
pPort
=
strtol
(
pPortToken
->
z
,
NULL
,
10
);
*
pPort
=
taosStr2Int32
(
pPortToken
->
z
,
NULL
,
10
);
if
(
*
pPort
>=
UINT16_MAX
||
*
pPort
<=
0
)
{
pCxt
->
errCode
=
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_PORT
);
}
...
...
@@ -476,9 +476,9 @@ SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, SNode* pLeft
SNode
*
createLimitNode
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pLimit
,
const
SToken
*
pOffset
)
{
SLimitNode
*
limitNode
=
(
SLimitNode
*
)
nodesMakeNode
(
QUERY_NODE_LIMIT
);
CHECK_OUT_OF_MEM
(
limitNode
);
limitNode
->
limit
=
strtol
(
pLimit
->
z
,
NULL
,
10
);
limitNode
->
limit
=
taosStr2Int64
(
pLimit
->
z
,
NULL
,
10
);
if
(
NULL
!=
pOffset
)
{
limitNode
->
offset
=
strtol
(
pOffset
->
z
,
NULL
,
10
);
limitNode
->
offset
=
taosStr2Int64
(
pOffset
->
z
,
NULL
,
10
);
}
return
(
SNode
*
)
limitNode
;
}
...
...
@@ -694,59 +694,59 @@ SNode* createAlterDatabaseOptions(SAstCreateContext* pCxt) {
SNode
*
setDatabaseOption
(
SAstCreateContext
*
pCxt
,
SNode
*
pOptions
,
EDatabaseOptionType
type
,
void
*
pVal
)
{
switch
(
type
)
{
case
DB_OPTION_BUFFER
:
((
SDatabaseOptions
*
)
pOptions
)
->
buffer
=
strtol
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
((
SDatabaseOptions
*
)
pOptions
)
->
buffer
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_CACHELAST
:
((
SDatabaseOptions
*
)
pOptions
)
->
cachelast
=
strtol
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
((
SDatabaseOptions
*
)
pOptions
)
->
cachelast
=
taosStr2Int8
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_COMP
:
((
SDatabaseOptions
*
)
pOptions
)
->
compressionLevel
=
strtol
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
((
SDatabaseOptions
*
)
pOptions
)
->
compressionLevel
=
taosStr2Int8
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_DAYS
:
{
SToken
*
pToken
=
pVal
;
if
(
TK_NK_INTEGER
==
pToken
->
type
)
{
((
SDatabaseOptions
*
)
pOptions
)
->
daysPerFile
=
strtol
(
pToken
->
z
,
NULL
,
10
)
*
1440
;
((
SDatabaseOptions
*
)
pOptions
)
->
daysPerFile
=
taosStr2Int32
(
pToken
->
z
,
NULL
,
10
)
*
1440
;
}
else
{
((
SDatabaseOptions
*
)
pOptions
)
->
pDaysPerFile
=
(
SValueNode
*
)
createDurationValueNode
(
pCxt
,
pToken
);
}
break
;
}
case
DB_OPTION_FSYNC
:
((
SDatabaseOptions
*
)
pOptions
)
->
fsyncPeriod
=
strtol
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
((
SDatabaseOptions
*
)
pOptions
)
->
fsyncPeriod
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_MAXROWS
:
((
SDatabaseOptions
*
)
pOptions
)
->
maxRowsPerBlock
=
strtol
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
((
SDatabaseOptions
*
)
pOptions
)
->
maxRowsPerBlock
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_MINROWS
:
((
SDatabaseOptions
*
)
pOptions
)
->
minRowsPerBlock
=
strtol
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
((
SDatabaseOptions
*
)
pOptions
)
->
minRowsPerBlock
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_KEEP
:
((
SDatabaseOptions
*
)
pOptions
)
->
pKeep
=
pVal
;
break
;
case
DB_OPTION_PAGES
:
((
SDatabaseOptions
*
)
pOptions
)
->
pages
=
strtol
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
((
SDatabaseOptions
*
)
pOptions
)
->
pages
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_PAGESIZE
:
((
SDatabaseOptions
*
)
pOptions
)
->
pagesize
=
strtol
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
((
SDatabaseOptions
*
)
pOptions
)
->
pagesize
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_PRECISION
:
copyStringFormStringToken
((
SToken
*
)
pVal
,
((
SDatabaseOptions
*
)
pOptions
)
->
precisionStr
,
sizeof
(((
SDatabaseOptions
*
)
pOptions
)
->
precisionStr
));
break
;
case
DB_OPTION_REPLICA
:
((
SDatabaseOptions
*
)
pOptions
)
->
replica
=
strtol
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
((
SDatabaseOptions
*
)
pOptions
)
->
replica
=
taosStr2Int8
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_STRICT
:
((
SDatabaseOptions
*
)
pOptions
)
->
strict
=
strtol
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
((
SDatabaseOptions
*
)
pOptions
)
->
strict
=
taosStr2Int8
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_WAL
:
((
SDatabaseOptions
*
)
pOptions
)
->
walLevel
=
strtol
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
((
SDatabaseOptions
*
)
pOptions
)
->
walLevel
=
taosStr2Int8
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_VGROUPS
:
((
SDatabaseOptions
*
)
pOptions
)
->
numOfVgroups
=
strtol
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
((
SDatabaseOptions
*
)
pOptions
)
->
numOfVgroups
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_SINGLE_STABLE
:
((
SDatabaseOptions
*
)
pOptions
)
->
singleStable
=
strtol
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
((
SDatabaseOptions
*
)
pOptions
)
->
singleStable
=
taosStr2Int8
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
DB_OPTION_RETENTIONS
:
((
SDatabaseOptions
*
)
pOptions
)
->
pRetentions
=
pVal
;
...
...
@@ -827,16 +827,16 @@ SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType
sizeof
(((
STableOptions
*
)
pOptions
)
->
comment
));
break
;
case
TABLE_OPTION_DELAY
:
((
STableOptions
*
)
pOptions
)
->
delay
=
strtol
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
((
STableOptions
*
)
pOptions
)
->
delay
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
TABLE_OPTION_FILE_FACTOR
:
((
STableOptions
*
)
pOptions
)
->
filesFactor
=
strtod
(((
SToken
*
)
pVal
)
->
z
,
NULL
);
((
STableOptions
*
)
pOptions
)
->
filesFactor
=
taosStr2Float
(((
SToken
*
)
pVal
)
->
z
,
NULL
);
break
;
case
TABLE_OPTION_ROLLUP
:
((
STableOptions
*
)
pOptions
)
->
pRollupFuncs
=
pVal
;
break
;
case
TABLE_OPTION_TTL
:
((
STableOptions
*
)
pOptions
)
->
ttl
=
strtol
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
((
STableOptions
*
)
pOptions
)
->
ttl
=
taosStr2Int32
(((
SToken
*
)
pVal
)
->
z
,
NULL
,
10
);
break
;
case
TABLE_OPTION_SMA
:
((
STableOptions
*
)
pOptions
)
->
pSma
=
pVal
;
...
...
@@ -868,7 +868,7 @@ SDataType createDataType(uint8_t type) {
}
SDataType
createVarLenDataType
(
uint8_t
type
,
const
SToken
*
pLen
)
{
SDataType
dt
=
{.
type
=
type
,
.
precision
=
0
,
.
scale
=
0
,
.
bytes
=
strtol
(
pLen
->
z
,
NULL
,
10
)};
SDataType
dt
=
{.
type
=
type
,
.
precision
=
0
,
.
scale
=
0
,
.
bytes
=
taosStr2Int16
(
pLen
->
z
,
NULL
,
10
)};
return
dt
;
}
...
...
@@ -1119,7 +1119,7 @@ SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode) {
SDropDnodeStmt
*
pStmt
=
(
SDropDnodeStmt
*
)
nodesMakeNode
(
QUERY_NODE_DROP_DNODE_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
if
(
TK_NK_INTEGER
==
pDnode
->
type
)
{
pStmt
->
dnodeId
=
strtol
(
pDnode
->
z
,
NULL
,
10
);
pStmt
->
dnodeId
=
taosStr2Int32
(
pDnode
->
z
,
NULL
,
10
);
}
else
{
if
(
!
checkAndSplitEndpoint
(
pCxt
,
pDnode
,
pStmt
->
fqdn
,
&
pStmt
->
port
))
{
nodesDestroyNode
(
pStmt
);
...
...
@@ -1133,7 +1133,7 @@ SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const
const
SToken
*
pValue
)
{
SAlterDnodeStmt
*
pStmt
=
nodesMakeNode
(
QUERY_NODE_ALTER_DNODE_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
dnodeId
=
strtol
(
pDnode
->
z
,
NULL
,
10
);
pStmt
->
dnodeId
=
taosStr2Int32
(
pDnode
->
z
,
NULL
,
10
);
trimString
(
pConfig
->
z
,
pConfig
->
n
,
pStmt
->
config
,
sizeof
(
pStmt
->
config
));
if
(
NULL
!=
pValue
)
{
trimString
(
pValue
->
z
,
pValue
->
n
,
pStmt
->
value
,
sizeof
(
pStmt
->
value
));
...
...
@@ -1183,7 +1183,7 @@ SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken
SNode
*
createCreateComponentNodeStmt
(
SAstCreateContext
*
pCxt
,
ENodeType
type
,
const
SToken
*
pDnodeId
)
{
SCreateComponentNodeStmt
*
pStmt
=
nodesMakeNode
(
type
);
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
dnodeId
=
strtol
(
pDnodeId
->
z
,
NULL
,
10
);
pStmt
->
dnodeId
=
taosStr2Int32
(
pDnodeId
->
z
,
NULL
,
10
);
;
return
(
SNode
*
)
pStmt
;
}
...
...
@@ -1191,7 +1191,7 @@ SNode* createCreateComponentNodeStmt(SAstCreateContext* pCxt, ENodeType type, co
SNode
*
createDropComponentNodeStmt
(
SAstCreateContext
*
pCxt
,
ENodeType
type
,
const
SToken
*
pDnodeId
)
{
SDropComponentNodeStmt
*
pStmt
=
nodesMakeNode
(
type
);
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
dnodeId
=
strtol
(
pDnodeId
->
z
,
NULL
,
10
);
pStmt
->
dnodeId
=
taosStr2Int32
(
pDnodeId
->
z
,
NULL
,
10
);
;
return
(
SNode
*
)
pStmt
;
}
...
...
@@ -1251,7 +1251,7 @@ SNode* setExplainVerbose(SAstCreateContext* pCxt, SNode* pOptions, const SToken*
}
SNode
*
setExplainRatio
(
SAstCreateContext
*
pCxt
,
SNode
*
pOptions
,
const
SToken
*
pVal
)
{
((
SExplainOptions
*
)
pOptions
)
->
ratio
=
strtod
(
pVal
->
z
,
NULL
);
((
SExplainOptions
*
)
pOptions
)
->
ratio
=
taosStr2Double
(
pVal
->
z
,
NULL
);
return
pOptions
;
}
...
...
@@ -1347,7 +1347,7 @@ SNode* createDropStreamStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const
SNode
*
createKillStmt
(
SAstCreateContext
*
pCxt
,
ENodeType
type
,
const
SToken
*
pId
)
{
SKillStmt
*
pStmt
=
nodesMakeNode
(
type
);
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
targetId
=
strtol
(
pId
->
z
,
NULL
,
10
);
pStmt
->
targetId
=
taosStr2Int32
(
pId
->
z
,
NULL
,
10
);
return
(
SNode
*
)
pStmt
;
}
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
8add9a9a
...
...
@@ -442,7 +442,7 @@ static bool isNullStr(SToken* pToken) {
static
FORCE_INLINE
int32_t
toDouble
(
SToken
*
pToken
,
double
*
value
,
char
**
endPtr
)
{
errno
=
0
;
*
value
=
strtold
(
pToken
->
z
,
endPtr
);
*
value
=
taosStr2Double
(
pToken
->
z
,
endPtr
);
// not a valid integer number, return error
if
((
*
endPtr
-
pToken
->
z
)
!=
pToken
->
n
)
{
...
...
@@ -482,9 +482,9 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int
return
buildSyntaxErrMsg
(
pMsgBuf
,
"invalid bool data"
,
pToken
->
z
);
}
}
else
if
(
pToken
->
type
==
TK_NK_INTEGER
)
{
return
func
(
pMsgBuf
,
((
strtoll
(
pToken
->
z
,
NULL
,
10
)
==
0
)
?
&
FALSE_VALUE
:
&
TRUE_VALUE
),
pSchema
->
bytes
,
param
);
return
func
(
pMsgBuf
,
((
taosStr2Int64
(
pToken
->
z
,
NULL
,
10
)
==
0
)
?
&
FALSE_VALUE
:
&
TRUE_VALUE
),
pSchema
->
bytes
,
param
);
}
else
if
(
pToken
->
type
==
TK_NK_FLOAT
)
{
return
func
(
pMsgBuf
,
((
strtod
(
pToken
->
z
,
NULL
)
==
0
)
?
&
FALSE_VALUE
:
&
TRUE_VALUE
),
pSchema
->
bytes
,
param
);
return
func
(
pMsgBuf
,
((
taosStr2Double
(
pToken
->
z
,
NULL
)
==
0
)
?
&
FALSE_VALUE
:
&
TRUE_VALUE
),
pSchema
->
bytes
,
param
);
}
else
{
return
buildSyntaxErrMsg
(
pMsgBuf
,
"invalid bool data"
,
pToken
->
z
);
}
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
8add9a9a
...
...
@@ -498,7 +498,7 @@ static int32_t parseTimeFromValueNode(SValueNode* pVal) {
return
TSDB_CODE_SUCCESS
;
}
char
*
pEnd
=
NULL
;
pVal
->
datum
.
i
=
strtoll
(
pVal
->
literal
,
&
pEnd
,
10
);
pVal
->
datum
.
i
=
taosStr2Int64
(
pVal
->
literal
,
&
pEnd
,
10
);
return
(
NULL
!=
pEnd
&&
'\0'
==
*
pEnd
)
?
TSDB_CODE_SUCCESS
:
TSDB_CODE_FAILED
;
}
else
{
return
TSDB_CODE_FAILED
;
...
...
@@ -527,61 +527,61 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD
break
;
case
TSDB_DATA_TYPE_TINYINT
:
{
char
*
endPtr
=
NULL
;
pVal
->
datum
.
i
=
strtoll
(
pVal
->
literal
,
&
endPtr
,
10
);
pVal
->
datum
.
i
=
taosStr2Int64
(
pVal
->
literal
,
&
endPtr
,
10
);
*
(
int8_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
i
;
break
;
}
case
TSDB_DATA_TYPE_SMALLINT
:
{
char
*
endPtr
=
NULL
;
pVal
->
datum
.
i
=
strtoll
(
pVal
->
literal
,
&
endPtr
,
10
);
pVal
->
datum
.
i
=
taosStr2Int64
(
pVal
->
literal
,
&
endPtr
,
10
);
*
(
int16_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
i
;
break
;
}
case
TSDB_DATA_TYPE_INT
:
{
char
*
endPtr
=
NULL
;
pVal
->
datum
.
i
=
strtoll
(
pVal
->
literal
,
&
endPtr
,
10
);
pVal
->
datum
.
i
=
taosStr2Int64
(
pVal
->
literal
,
&
endPtr
,
10
);
*
(
int32_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
i
;
break
;
}
case
TSDB_DATA_TYPE_BIGINT
:
{
char
*
endPtr
=
NULL
;
pVal
->
datum
.
i
=
strtoll
(
pVal
->
literal
,
&
endPtr
,
10
);
pVal
->
datum
.
i
=
taosStr2Int64
(
pVal
->
literal
,
&
endPtr
,
10
);
*
(
int64_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
i
;
break
;
}
case
TSDB_DATA_TYPE_UTINYINT
:
{
char
*
endPtr
=
NULL
;
pVal
->
datum
.
u
=
strtoull
(
pVal
->
literal
,
&
endPtr
,
10
);
pVal
->
datum
.
u
=
taosStr2UInt64
(
pVal
->
literal
,
&
endPtr
,
10
);
*
(
uint8_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
u
;
break
;
}
case
TSDB_DATA_TYPE_USMALLINT
:
{
char
*
endPtr
=
NULL
;
pVal
->
datum
.
u
=
strtoull
(
pVal
->
literal
,
&
endPtr
,
10
);
pVal
->
datum
.
u
=
taosStr2UInt64
(
pVal
->
literal
,
&
endPtr
,
10
);
*
(
uint16_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
u
;
break
;
}
case
TSDB_DATA_TYPE_UINT
:
{
char
*
endPtr
=
NULL
;
pVal
->
datum
.
u
=
strtoull
(
pVal
->
literal
,
&
endPtr
,
10
);
pVal
->
datum
.
u
=
taosStr2UInt64
(
pVal
->
literal
,
&
endPtr
,
10
);
*
(
uint32_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
u
;
break
;
}
case
TSDB_DATA_TYPE_UBIGINT
:
{
char
*
endPtr
=
NULL
;
pVal
->
datum
.
u
=
strtoull
(
pVal
->
literal
,
&
endPtr
,
10
);
pVal
->
datum
.
u
=
taosStr2UInt64
(
pVal
->
literal
,
&
endPtr
,
10
);
*
(
uint64_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
u
;
break
;
}
case
TSDB_DATA_TYPE_FLOAT
:
{
char
*
endPtr
=
NULL
;
pVal
->
datum
.
d
=
strtold
(
pVal
->
literal
,
&
endPtr
);
pVal
->
datum
.
d
=
taosStr2Double
(
pVal
->
literal
,
&
endPtr
);
*
(
float
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
d
;
break
;
}
case
TSDB_DATA_TYPE_DOUBLE
:
{
char
*
endPtr
=
NULL
;
pVal
->
datum
.
d
=
strtold
(
pVal
->
literal
,
&
endPtr
);
pVal
->
datum
.
d
=
taosStr2Double
(
pVal
->
literal
,
&
endPtr
);
*
(
double
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
d
;
break
;
}
...
...
source/libs/parser/src/sql.c
浏览文件 @
8add9a9a
...
...
@@ -3863,7 +3863,7 @@ static YYACTIONTYPE yy_reduce(
{
yymsp
[
1
].
minor
.
yy140
=
0
;
}
break
;
case
245
:
/* bufsize_opt ::= BUFSIZE NK_INTEGER */
{
yymsp
[
-
1
].
minor
.
yy140
=
strtol
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
{
yymsp
[
-
1
].
minor
.
yy140
=
taosStr2Int32
(
yymsp
[
0
].
minor
.
yy0
.
z
,
NULL
,
10
);
}
break
;
case
246
:
/* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */
{
pCxt
->
pRootNode
=
createCreateStreamStmt
(
pCxt
,
yymsp
[
-
5
].
minor
.
yy617
,
&
yymsp
[
-
4
].
minor
.
yy105
,
yymsp
[
-
2
].
minor
.
yy172
,
yymsp
[
-
3
].
minor
.
yy172
,
yymsp
[
0
].
minor
.
yy172
);
}
...
...
source/libs/scalar/src/sclfunc.c
浏览文件 @
8add9a9a
...
...
@@ -724,7 +724,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
case
TSDB_DATA_TYPE_BIGINT
:
{
if
(
inputType
==
TSDB_DATA_TYPE_BINARY
)
{
memcpy
(
output
,
varDataVal
(
input
),
varDataLen
(
input
));
*
(
int64_t
*
)
output
=
strtoll
(
output
,
NULL
,
10
);
*
(
int64_t
*
)
output
=
taosStr2Int64
(
output
,
NULL
,
10
);
}
else
if
(
inputType
==
TSDB_DATA_TYPE_NCHAR
)
{
char
*
newBuf
=
taosMemoryCalloc
(
1
,
outputLen
*
TSDB_NCHAR_SIZE
+
1
);
int32_t
len
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
input
),
varDataLen
(
input
),
newBuf
);
...
...
@@ -733,7 +733,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
return
TSDB_CODE_FAILED
;
}
newBuf
[
len
]
=
0
;
*
(
int64_t
*
)
output
=
strtoll
(
newBuf
,
NULL
,
10
);
*
(
int64_t
*
)
output
=
taosStr2Int64
(
newBuf
,
NULL
,
10
);
taosMemoryFree
(
newBuf
);
}
else
{
GET_TYPED_DATA
(
*
(
int64_t
*
)
output
,
int64_t
,
inputType
,
input
);
...
...
@@ -743,7 +743,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
case
TSDB_DATA_TYPE_UBIGINT
:
{
if
(
inputType
==
TSDB_DATA_TYPE_BINARY
)
{
memcpy
(
output
,
varDataVal
(
input
),
varDataLen
(
input
));
*
(
uint64_t
*
)
output
=
strtoull
(
output
,
NULL
,
10
);
*
(
uint64_t
*
)
output
=
taosStr2UInt64
(
output
,
NULL
,
10
);
}
else
if
(
inputType
==
TSDB_DATA_TYPE_NCHAR
)
{
char
*
newBuf
=
taosMemoryCalloc
(
1
,
outputLen
*
TSDB_NCHAR_SIZE
+
1
);
int32_t
len
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
input
),
varDataLen
(
input
),
newBuf
);
...
...
@@ -752,7 +752,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
return
TSDB_CODE_FAILED
;
}
newBuf
[
len
]
=
0
;
*
(
uint64_t
*
)
output
=
strtoull
(
newBuf
,
NULL
,
10
);
*
(
uint64_t
*
)
output
=
taosStr2UInt64
(
newBuf
,
NULL
,
10
);
taosMemoryFree
(
newBuf
);
}
else
{
GET_TYPED_DATA
(
*
(
uint64_t
*
)
output
,
uint64_t
,
inputType
,
input
);
...
...
source/libs/scalar/src/sclvector.c
浏览文件 @
8add9a9a
...
...
@@ -92,7 +92,7 @@ void convertStringToDouble(const void *inData, void *outData, int8_t inType, int
tmp
[
len
]
=
0
;
ASSERT
(
outType
==
TSDB_DATA_TYPE_DOUBLE
);
double
value
=
strtod
(
tmp
,
NULL
);
double
value
=
taosStr2Double
(
tmp
,
NULL
);
*
((
double
*
)
outData
)
=
value
;
taosMemoryFreeClear
(
tmp
);
...
...
@@ -267,22 +267,22 @@ static FORCE_INLINE void varToTimestamp(char *buf, SScalarParam* pOut, int32_t r
static
FORCE_INLINE
void
varToSigned
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
)
{
switch
(
pOut
->
columnData
->
info
.
type
)
{
case
TSDB_DATA_TYPE_TINYINT
:
{
int8_t
value
=
(
int8_t
)
strtoll
(
buf
,
NULL
,
10
);
int8_t
value
=
(
int8_t
)
taosStr2Int8
(
buf
,
NULL
,
10
);
colDataAppendInt8
(
pOut
->
columnData
,
rowIndex
,
(
int8_t
*
)
&
value
);
break
;
}
case
TSDB_DATA_TYPE_SMALLINT
:
{
int16_t
value
=
(
int16_t
)
strtoll
(
buf
,
NULL
,
10
);
int16_t
value
=
(
int16_t
)
taosStr2Int16
(
buf
,
NULL
,
10
);
colDataAppendInt16
(
pOut
->
columnData
,
rowIndex
,
(
int16_t
*
)
&
value
);
break
;
}
case
TSDB_DATA_TYPE_INT
:
{
int32_t
value
=
(
int32_t
)
strtoll
(
buf
,
NULL
,
10
);
int32_t
value
=
(
int32_t
)
taosStr2Int32
(
buf
,
NULL
,
10
);
colDataAppendInt32
(
pOut
->
columnData
,
rowIndex
,
(
int32_t
*
)
&
value
);
break
;
}
case
TSDB_DATA_TYPE_BIGINT
:
{
int64_t
value
=
(
int64_t
)
strtoll
(
buf
,
NULL
,
10
);
int64_t
value
=
(
int64_t
)
taosStr2Int64
(
buf
,
NULL
,
10
);
colDataAppendInt64
(
pOut
->
columnData
,
rowIndex
,
(
int64_t
*
)
&
value
);
break
;
}
...
...
@@ -292,22 +292,22 @@ static FORCE_INLINE void varToSigned(char *buf, SScalarParam* pOut, int32_t rowI
static
FORCE_INLINE
void
varToUnsigned
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
)
{
switch
(
pOut
->
columnData
->
info
.
type
)
{
case
TSDB_DATA_TYPE_UTINYINT
:
{
uint8_t
value
=
(
uint8_t
)
strtoull
(
buf
,
NULL
,
10
);
uint8_t
value
=
(
uint8_t
)
taosStr2UInt8
(
buf
,
NULL
,
10
);
colDataAppendInt8
(
pOut
->
columnData
,
rowIndex
,
(
int8_t
*
)
&
value
);
break
;
}
case
TSDB_DATA_TYPE_USMALLINT
:
{
uint16_t
value
=
(
uint16_t
)
strtoull
(
buf
,
NULL
,
10
);
uint16_t
value
=
(
uint16_t
)
taosStr2UInt16
(
buf
,
NULL
,
10
);
colDataAppendInt16
(
pOut
->
columnData
,
rowIndex
,
(
int16_t
*
)
&
value
);
break
;
}
case
TSDB_DATA_TYPE_UINT
:
{
uint32_t
value
=
(
uint32_t
)
strtoull
(
buf
,
NULL
,
10
);
uint32_t
value
=
(
uint32_t
)
taosStr2UInt32
(
buf
,
NULL
,
10
);
colDataAppendInt32
(
pOut
->
columnData
,
rowIndex
,
(
int32_t
*
)
&
value
);
break
;
}
case
TSDB_DATA_TYPE_UBIGINT
:
{
uint64_t
value
=
(
uint64_t
)
strtoull
(
buf
,
NULL
,
10
);
uint64_t
value
=
(
uint64_t
)
taosStr2UInt64
(
buf
,
NULL
,
10
);
colDataAppendInt64
(
pOut
->
columnData
,
rowIndex
,
(
int64_t
*
)
&
value
);
break
;
}
...
...
@@ -315,12 +315,12 @@ static FORCE_INLINE void varToUnsigned(char *buf, SScalarParam* pOut, int32_t ro
}
static
FORCE_INLINE
void
varToFloat
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
)
{
double
value
=
strtod
(
buf
,
NULL
);
double
value
=
taosStr2Double
(
buf
,
NULL
);
colDataAppendDouble
(
pOut
->
columnData
,
rowIndex
,
&
value
);
}
static
FORCE_INLINE
void
varToBool
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
)
{
int64_t
value
=
strtoll
(
buf
,
NULL
,
10
);
int64_t
value
=
taosStr2Int64
(
buf
,
NULL
,
10
);
bool
v
=
(
value
!=
0
)
?
true
:
false
;
colDataAppendInt8
(
pOut
->
columnData
,
rowIndex
,
(
int8_t
*
)
&
v
);
}
...
...
source/os/CMakeLists.txt
浏览文件 @
8add9a9a
...
...
@@ -27,6 +27,9 @@ if(BUILD_ADDR2LINE)
os PUBLIC addr2line dl z
)
endif
()
if
(
CHECK_STR2INT_ERROR
)
add_definitions
(
-DTD_CHECK_STR_TO_INT_ERROR
)
endif
()
target_link_libraries
(
os PUBLIC pthread
)
...
...
source/os/src/osString.c
浏览文件 @
8add9a9a
...
...
@@ -254,4 +254,103 @@ char *taosStrCaseStr(const char *str, const char *pattern) {
}
}
return
NULL
;
}
int64_t
taosStr2Int64
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
)
{
int64_t
tmp
=
strtoll
(
str
,
pEnd
,
radix
);
#ifdef TD_CHECK_STR_TO_INT_ERROR
assert
(
errno
!=
ERANGE
);
assert
(
errno
!=
EINVAL
);
#endif
return
tmp
;
}
uint64_t
taosStr2UInt64
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
)
{
uint64_t
tmp
=
strtoull
(
str
,
pEnd
,
radix
);
#ifdef TD_CHECK_STR_TO_INT_ERROR
assert
(
errno
!=
ERANGE
);
assert
(
errno
!=
EINVAL
);
#endif
return
tmp
;
}
int32_t
taosStr2Int32
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
)
{
int32_t
tmp
=
strtol
(
str
,
pEnd
,
radix
);
#ifdef TD_CHECK_STR_TO_INT_ERROR
assert
(
errno
!=
ERANGE
);
assert
(
errno
!=
EINVAL
);
#endif
return
tmp
;
}
uint32_t
taosStr2UInt32
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
)
{
uint32_t
tmp
=
strtol
(
str
,
pEnd
,
radix
);
#ifdef TD_CHECK_STR_TO_INT_ERROR
assert
(
errno
!=
ERANGE
);
assert
(
errno
!=
EINVAL
);
#endif
return
tmp
;
}
int16_t
taosStr2Int16
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
)
{
int32_t
tmp
=
strtol
(
str
,
pEnd
,
radix
);
#ifdef TD_CHECK_STR_TO_INT_ERROR
assert
(
errno
!=
ERANGE
);
assert
(
errno
!=
EINVAL
);
assert
(
tmp
>=
SHRT_MIN
);
assert
(
tmp
<=
SHRT_MAX
);
#endif
return
(
int16_t
)
tmp
;
}
uint16_t
taosStr2UInt16
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
)
{
uint32_t
tmp
=
strtoul
(
str
,
pEnd
,
radix
);
#ifdef TD_CHECK_STR_TO_INT_ERROR
assert
(
errno
!=
ERANGE
);
assert
(
errno
!=
EINVAL
);
assert
(
tmp
<=
USHRT_MAX
);
#endif
return
(
uint16_t
)
tmp
;
}
int8_t
taosStr2Int8
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
)
{
int32_t
tmp
=
strtol
(
str
,
pEnd
,
radix
);
#ifdef TD_CHECK_STR_TO_INT_ERROR
assert
(
errno
!=
ERANGE
);
assert
(
errno
!=
EINVAL
);
assert
(
tmp
>=
SCHAR_MIN
);
assert
(
tmp
<=
SCHAR_MAX
);
#endif
return
tmp
;
}
uint8_t
taosStr2UInt8
(
const
char
*
str
,
char
**
pEnd
,
int32_t
radix
)
{
uint32_t
tmp
=
strtoul
(
str
,
pEnd
,
radix
);
#ifdef TD_CHECK_STR_TO_INT_ERROR
assert
(
errno
!=
ERANGE
);
assert
(
errno
!=
EINVAL
);
assert
(
tmp
<=
UCHAR_MAX
);
#endif
return
tmp
;
}
double
taosStr2Double
(
const
char
*
str
,
char
**
pEnd
)
{
double
tmp
=
strtod
(
str
,
pEnd
);
#ifdef TD_CHECK_STR_TO_INT_ERROR
assert
(
errno
!=
ERANGE
);
assert
(
errno
!=
EINVAL
);
assert
(
tmp
!=
HUGE_VAL
);
#endif
return
tmp
;
}
float
taosStr2Float
(
const
char
*
str
,
char
**
pEnd
)
{
float
tmp
=
strtof
(
str
,
pEnd
);
#ifdef TD_CHECK_STR_TO_INT_ERROR
assert
(
errno
!=
ERANGE
);
assert
(
errno
!=
EINVAL
);
assert
(
tmp
!=
HUGE_VALF
);
assert
(
tmp
!=
NAN
);
#endif
return
tmp
;
}
\ No newline at end of file
source/util/src/tjson.c
浏览文件 @
8add9a9a
...
...
@@ -187,7 +187,7 @@ int32_t tjsonGetBigIntValue(const SJson* pJson, const char* pName, int64_t* pVal
sscanf
(
p
,
"%lld"
,
pVal
);
#else
// sscanf(p,"%ld",pVal);
*
pVal
=
strtol
(
p
,
NULL
,
10
);
*
pVal
=
taosStr2Int64
(
p
,
NULL
,
10
);
#endif
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -222,7 +222,7 @@ int32_t tjsonGetUBigIntValue(const SJson* pJson, const char* pName, uint64_t* pV
sscanf
(
p
,
"%llu"
,
pVal
);
#else
// sscanf(p,"%ld",pVal);
*
pVal
=
strtoul
(
p
,
NULL
,
10
);
*
pVal
=
taosStr2UInt64
(
p
,
NULL
,
10
);
#endif
return
TSDB_CODE_SUCCESS
;
}
...
...
tools/shell/src/shellEngine.c
浏览文件 @
8add9a9a
...
...
@@ -195,16 +195,16 @@ void shellRunSingleCommandImp(char *command) {
et
=
taosGetTimestampUs
();
if
(
error_no
==
0
)
{
printf
(
"Query OK, %d row
(s) in set
(%.6fs)
\n
"
,
numOfRows
,
(
et
-
st
)
/
1E6
);
printf
(
"Query OK, %d row
s affected
(%.6fs)
\n
"
,
numOfRows
,
(
et
-
st
)
/
1E6
);
}
else
{
printf
(
"Query interrupted (%s), %d row
(s) in set
(%.6fs)
\n
"
,
taos_errstr
(
pSql
),
numOfRows
,
(
et
-
st
)
/
1E6
);
printf
(
"Query interrupted (%s), %d row
s affected
(%.6fs)
\n
"
,
taos_errstr
(
pSql
),
numOfRows
,
(
et
-
st
)
/
1E6
);
}
taos_free_result
(
pSql
);
}
else
{
int32_t
num_rows_affacted
=
taos_affected_rows
(
pSql
);
taos_free_result
(
pSql
);
et
=
taosGetTimestampUs
();
printf
(
"Query OK, %d of %d row
(s) in database
(%.6fs)
\n
"
,
num_rows_affacted
,
num_rows_affacted
,
(
et
-
st
)
/
1E6
);
printf
(
"Query OK, %d of %d row
s affected
(%.6fs)
\n
"
,
num_rows_affacted
,
num_rows_affacted
,
(
et
-
st
)
/
1E6
);
}
printf
(
"
\n
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录