Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
90b1527e
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
90b1527e
编写于
4月 14, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
差异文件
merge from 3.0
上级
3e380176
4eb20bda
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
95 addition
and
48 deletion
+95
-48
example/src/tmq.c
example/src/tmq.c
+3
-2
include/common/ttime.h
include/common/ttime.h
+19
-0
include/os/osTime.h
include/os/osTime.h
+4
-0
packaging/install.sh
packaging/install.sh
+7
-0
packaging/release.sh
packaging/release.sh
+3
-0
source/client/src/tmq.c
source/client/src/tmq.c
+1
-1
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+1
-1
source/common/src/ttime.c
source/common/src/ttime.c
+5
-5
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+2
-2
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+4
-2
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+1
-1
source/os/src/osTime.c
source/os/src/osTime.c
+11
-0
tests/script/tsim/query/charScalarFunction.sim
tests/script/tsim/query/charScalarFunction.sim
+32
-32
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+1
-1
tools/shell/src/shellEngine.c
tools/shell/src/shellEngine.c
+1
-1
tools/taosTools-1.4.1-Linux-x64.tar.gz
tools/taosTools-1.4.1-Linux-x64.tar.gz
+0
-0
未找到文件。
example/src/tmq.c
浏览文件 @
90b1527e
...
@@ -54,7 +54,8 @@ int32_t init_env() {
...
@@ -54,7 +54,8 @@ int32_t init_env() {
}
}
taos_free_result
(
pRes
);
taos_free_result
(
pRes
);
pRes
=
taos_query
(
pConn
,
"create stable if not exists st1 (ts timestamp, c1 int, c2 float, c4 int) tags(t1 int)"
);
pRes
=
taos_query
(
pConn
,
"create stable if not exists st1 (ts timestamp, c1 int, c2 float, c3 binary(10)) tags(t1 int)"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to create super table st1, reason:%s
\n
"
,
taos_errstr
(
pRes
));
printf
(
"failed to create super table st1, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
return
-
1
;
...
@@ -101,7 +102,7 @@ int32_t create_topic() {
...
@@ -101,7 +102,7 @@ int32_t create_topic() {
/*const char* sql = "select * from tu1";*/
/*const char* sql = "select * from tu1";*/
/*pRes = tmq_create_topic(pConn, "test_stb_topic_1", sql, strlen(sql));*/
/*pRes = tmq_create_topic(pConn, "test_stb_topic_1", sql, strlen(sql));*/
pRes
=
taos_query
(
pConn
,
"create topic topic_ctb_column as select ts, c1, c2, c
4
from ct1"
);
pRes
=
taos_query
(
pConn
,
"create topic topic_ctb_column as select ts, c1, c2, c
3
from ct1"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to create topic topic_ctb_column, reason:%s
\n
"
,
taos_errstr
(
pRes
));
printf
(
"failed to create topic topic_ctb_column, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
return
-
1
;
...
...
include/common/ttime.h
浏览文件 @
90b1527e
...
@@ -40,6 +40,7 @@ extern "C" {
...
@@ -40,6 +40,7 @@ extern "C" {
* @return timestamp decided by global conf variable, tsTimePrecision
* @return timestamp decided by global conf variable, tsTimePrecision
* if precision == TSDB_TIME_PRECISION_MICRO, it returns timestamp in microsecond.
* if precision == TSDB_TIME_PRECISION_MICRO, it returns timestamp in microsecond.
* precision == TSDB_TIME_PRECISION_MILLI, it returns timestamp in millisecond.
* precision == TSDB_TIME_PRECISION_MILLI, it returns timestamp in millisecond.
* precision == TSDB_TIME_PRECISION_NANO, it returns timestamp in nanosecond.
*/
*/
static
FORCE_INLINE
int64_t
taosGetTimestamp
(
int32_t
precision
)
{
static
FORCE_INLINE
int64_t
taosGetTimestamp
(
int32_t
precision
)
{
if
(
precision
==
TSDB_TIME_PRECISION_MICRO
)
{
if
(
precision
==
TSDB_TIME_PRECISION_MICRO
)
{
...
@@ -51,6 +52,24 @@ static FORCE_INLINE int64_t taosGetTimestamp(int32_t precision) {
...
@@ -51,6 +52,24 @@ static FORCE_INLINE int64_t taosGetTimestamp(int32_t precision) {
}
}
}
}
/*
* @return timestamp of today at 00:00:00 in given precision
* if precision == TSDB_TIME_PRECISION_MICRO, it returns timestamp in microsecond.
* precision == TSDB_TIME_PRECISION_MILLI, it returns timestamp in millisecond.
* precision == TSDB_TIME_PRECISION_NANO, it returns timestamp in nanosecond.
*/
static
FORCE_INLINE
int64_t
taosGetTimestampToday
(
int32_t
precision
)
{
int64_t
factor
=
(
precision
==
TSDB_TIME_PRECISION_MILLI
)
?
1000
:
(
precision
==
TSDB_TIME_PRECISION_MICRO
)
?
1000000
:
1000000000
;
time_t
t
=
taosTime
(
NULL
);
struct
tm
*
tm
=
taosLocalTime
(
&
t
,
NULL
);
tm
->
tm_hour
=
0
;
tm
->
tm_min
=
0
;
tm
->
tm_sec
=
0
;
return
(
int64_t
)
taosMktime
(
tm
)
*
factor
;
}
int64_t
taosTimeAdd
(
int64_t
t
,
int64_t
duration
,
char
unit
,
int32_t
precision
);
int64_t
taosTimeAdd
(
int64_t
t
,
int64_t
duration
,
char
unit
,
int32_t
precision
);
int64_t
taosTimeTruncate
(
int64_t
t
,
const
SInterval
*
pInterval
,
int32_t
precision
);
int64_t
taosTimeTruncate
(
int64_t
t
,
const
SInterval
*
pInterval
,
int32_t
precision
);
int32_t
taosTimeCountInterval
(
int64_t
skey
,
int64_t
ekey
,
int64_t
interval
,
char
unit
,
int32_t
precision
);
int32_t
taosTimeCountInterval
(
int64_t
skey
,
int64_t
ekey
,
int64_t
interval
,
char
unit
,
int32_t
precision
);
...
...
include/os/osTime.h
浏览文件 @
90b1527e
...
@@ -27,9 +27,11 @@ extern "C" {
...
@@ -27,9 +27,11 @@ extern "C" {
#ifndef ALLOW_FORBID_FUNC
#ifndef ALLOW_FORBID_FUNC
#define strptime STRPTIME_FUNC_TAOS_FORBID
#define strptime STRPTIME_FUNC_TAOS_FORBID
#define gettimeofday GETTIMEOFDAY_FUNC_TAOS_FORBID
#define gettimeofday GETTIMEOFDAY_FUNC_TAOS_FORBID
#define localtime LOCALTIME_FUNC_TAOS_FORBID
#define localtime_s LOCALTIMES_FUNC_TAOS_FORBID
#define localtime_s LOCALTIMES_FUNC_TAOS_FORBID
#define localtime_r LOCALTIMER_FUNC_TAOS_FORBID
#define localtime_r LOCALTIMER_FUNC_TAOS_FORBID
#define time TIME_FUNC_TAOS_FORBID
#define time TIME_FUNC_TAOS_FORBID
#define mktime MKTIME_FUNC_TAOS_FORBID
#endif
#endif
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
...
@@ -82,6 +84,8 @@ static FORCE_INLINE int64_t taosGetTimestampNs() {
...
@@ -82,6 +84,8 @@ static FORCE_INLINE int64_t taosGetTimestampNs() {
char
*
taosStrpTime
(
const
char
*
buf
,
const
char
*
fmt
,
struct
tm
*
tm
);
char
*
taosStrpTime
(
const
char
*
buf
,
const
char
*
fmt
,
struct
tm
*
tm
);
struct
tm
*
taosLocalTime
(
const
time_t
*
timep
,
struct
tm
*
result
);
struct
tm
*
taosLocalTime
(
const
time_t
*
timep
,
struct
tm
*
result
);
time_t
taosTime
(
time_t
*
t
);
time_t
taosMktime
(
struct
tm
*
timep
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
packaging/install.sh
浏览文件 @
90b1527e
...
@@ -228,6 +228,12 @@ function install_header() {
...
@@ -228,6 +228,12 @@ function install_header() {
${
csudo
}
ln
-s
${
install_main_dir
}
/include/taoserror.h
${
inc_link_dir
}
/taoserror.h
${
csudo
}
ln
-s
${
install_main_dir
}
/include/taoserror.h
${
inc_link_dir
}
/taoserror.h
}
}
# temp install taosBenchmark
function
install_taosTools
()
{
cd
${
script_dir
}
/taos-tools/
tar
xvf taosTools-1.4.1-Linux-x64.tar.gz
&&
cd
taosTools-1.4.1/
&&
./install-taostools.sh
}
function
add_newHostname_to_hosts
()
{
function
add_newHostname_to_hosts
()
{
localIp
=
"127.0.0.1"
localIp
=
"127.0.0.1"
OLD_IFS
=
"
$IFS
"
OLD_IFS
=
"
$IFS
"
...
@@ -473,6 +479,7 @@ function install_TDengine() {
...
@@ -473,6 +479,7 @@ function install_TDengine() {
install_log
install_log
install_header
install_header
install_lib
install_lib
install_taosTools
if
[
-z
$1
]
;
then
# install service and client
if
[
-z
$1
]
;
then
# install service and client
# For installing new
# For installing new
...
...
packaging/release.sh
浏览文件 @
90b1527e
...
@@ -55,6 +55,7 @@ mkdir -p ${install_dir}
...
@@ -55,6 +55,7 @@ mkdir -p ${install_dir}
mkdir
-p
${
install_dir
}
/bin
mkdir
-p
${
install_dir
}
/bin
mkdir
-p
${
install_dir
}
/lib
mkdir
-p
${
install_dir
}
/lib
mkdir
-p
${
install_dir
}
/inc
mkdir
-p
${
install_dir
}
/inc
mkdir
-p
${
install_dir
}
/taos-tools
install_files
=
"
${
script_dir
}
/install.sh"
install_files
=
"
${
script_dir
}
/install.sh"
chmod
a+x
${
script_dir
}
/install.sh
||
:
chmod
a+x
${
script_dir
}
/install.sh
||
:
...
@@ -68,6 +69,8 @@ cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || :
...
@@ -68,6 +69,8 @@ cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || :
cp
${
compile_dir
}
/source/client/libtaos.so
${
install_dir
}
/lib/
cp
${
compile_dir
}
/source/client/libtaos.so
${
install_dir
}
/lib/
cp
${
compile_dir
}
/source/libs/tdb/libtdb.so
${
install_dir
}
/lib/
cp
${
compile_dir
}
/source/libs/tdb/libtdb.so
${
install_dir
}
/lib/
taostoolfile
=
"
${
top_dir
}
/tools/taosTools-1.4.1-Linux-x64.tar.gz"
cp
${
taostoolfile
}
${
install_dir
}
/taos-tools
#cp ${compile_dir}/source/dnode/mnode/impl/libmnode.so ${install_dir}/lib/
#cp ${compile_dir}/source/dnode/mnode/impl/libmnode.so ${install_dir}/lib/
#cp ${compile_dir}/source/dnode/qnode/libqnode.so ${install_dir}/lib/
#cp ${compile_dir}/source/dnode/qnode/libqnode.so ${install_dir}/lib/
...
...
source/client/src/tmq.c
浏览文件 @
90b1527e
...
@@ -791,7 +791,7 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) {
...
@@ -791,7 +791,7 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) {
}
}
}
}
struct
tm
*
ptm
=
localtime
(
&
tt
);
struct
tm
*
ptm
=
taosLocalTime
(
&
tt
,
NULL
);
size_t
pos
=
strftime
(
buf
,
35
,
"%Y-%m-%d %H:%M:%S"
,
ptm
);
size_t
pos
=
strftime
(
buf
,
35
,
"%Y-%m-%d %H:%M:%S"
,
ptm
);
if
(
precision
==
TSDB_TIME_PRECISION_NANO
)
{
if
(
precision
==
TSDB_TIME_PRECISION_NANO
)
{
...
...
source/common/src/tdatablock.c
浏览文件 @
90b1527e
...
@@ -1368,7 +1368,7 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) {
...
@@ -1368,7 +1368,7 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) {
}
}
}
}
struct
tm
*
ptm
=
localtime
(
&
tt
);
struct
tm
*
ptm
=
taosLocalTime
(
&
tt
,
NULL
);
size_t
pos
=
strftime
(
buf
,
35
,
"%Y-%m-%d %H:%M:%S"
,
ptm
);
size_t
pos
=
strftime
(
buf
,
35
,
"%Y-%m-%d %H:%M:%S"
,
ptm
);
if
(
precision
==
TSDB_TIME_PRECISION_NANO
)
{
if
(
precision
==
TSDB_TIME_PRECISION_NANO
)
{
...
...
source/common/src/ttime.c
浏览文件 @
90b1527e
...
@@ -70,7 +70,7 @@ void deltaToUtcInitOnce() {
...
@@ -70,7 +70,7 @@ void deltaToUtcInitOnce() {
struct
tm
tm
=
{
0
};
struct
tm
tm
=
{
0
};
(
void
)
taosStrpTime
(
"1970-01-01 00:00:00"
,
(
const
char
*
)(
"%Y-%m-%d %H:%M:%S"
),
&
tm
);
(
void
)
taosStrpTime
(
"1970-01-01 00:00:00"
,
(
const
char
*
)(
"%Y-%m-%d %H:%M:%S"
),
&
tm
);
m_deltaUtc
=
(
int64_t
)
m
ktime
(
&
tm
);
m_deltaUtc
=
(
int64_t
)
taosM
ktime
(
&
tm
);
// printf("====delta:%lld\n\n", seconds);
// printf("====delta:%lld\n\n", seconds);
}
}
...
@@ -344,7 +344,7 @@ int32_t parseLocaltimeDst(char* timestr, int64_t* time, int32_t timePrec) {
...
@@ -344,7 +344,7 @@ int32_t parseLocaltimeDst(char* timestr, int64_t* time, int32_t timePrec) {
}
}
/* mktime will be affected by TZ, set by using taos_options */
/* mktime will be affected by TZ, set by using taos_options */
int64_t
seconds
=
m
ktime
(
&
tm
);
int64_t
seconds
=
taosM
ktime
(
&
tm
);
int64_t
fraction
=
0
;
int64_t
fraction
=
0
;
...
@@ -539,7 +539,7 @@ int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision) {
...
@@ -539,7 +539,7 @@ int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision) {
tm
.
tm_year
=
mon
/
12
;
tm
.
tm_year
=
mon
/
12
;
tm
.
tm_mon
=
mon
%
12
;
tm
.
tm_mon
=
mon
%
12
;
return
(
int64_t
)(
m
ktime
(
&
tm
)
*
TSDB_TICK_PER_SECOND
(
precision
));
return
(
int64_t
)(
taosM
ktime
(
&
tm
)
*
TSDB_TICK_PER_SECOND
(
precision
));
}
}
int32_t
taosTimeCountInterval
(
int64_t
skey
,
int64_t
ekey
,
int64_t
interval
,
char
unit
,
int32_t
precision
)
{
int32_t
taosTimeCountInterval
(
int64_t
skey
,
int64_t
ekey
,
int64_t
interval
,
char
unit
,
int32_t
precision
)
{
...
@@ -598,7 +598,7 @@ int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precisio
...
@@ -598,7 +598,7 @@ int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precisio
tm
.
tm_mon
=
mon
%
12
;
tm
.
tm_mon
=
mon
%
12
;
}
}
start
=
(
int64_t
)(
m
ktime
(
&
tm
)
*
TSDB_TICK_PER_SECOND
(
precision
));
start
=
(
int64_t
)(
taosM
ktime
(
&
tm
)
*
TSDB_TICK_PER_SECOND
(
precision
));
}
else
{
}
else
{
int64_t
delta
=
t
-
pInterval
->
interval
;
int64_t
delta
=
t
-
pInterval
->
interval
;
int32_t
factor
=
(
delta
>=
0
)
?
1
:
-
1
;
int32_t
factor
=
(
delta
>=
0
)
?
1
:
-
1
;
...
@@ -745,7 +745,7 @@ void taosFormatUtcTime(char* buf, int32_t bufLen, int64_t t, int32_t precision)
...
@@ -745,7 +745,7 @@ void taosFormatUtcTime(char* buf, int32_t bufLen, int64_t t, int32_t precision)
assert
(
false
);
assert
(
false
);
}
}
ptm
=
localtime
(
&
quot
);
ptm
=
taosLocalTime
(
&
quot
,
NULL
);
int32_t
length
=
(
int32_t
)
strftime
(
ts
,
40
,
"%Y-%m-%dT%H:%M:%S"
,
ptm
);
int32_t
length
=
(
int32_t
)
strftime
(
ts
,
40
,
"%Y-%m-%dT%H:%M:%S"
,
ptm
);
length
+=
snprintf
(
ts
+
length
,
fractionLen
,
format
,
mod
);
length
+=
snprintf
(
ts
+
length
,
fractionLen
,
format
,
mod
);
length
+=
(
int32_t
)
strftime
(
ts
+
length
,
40
-
length
,
"%z"
,
ptm
);
length
+=
(
int32_t
)
strftime
(
ts
+
length
,
40
-
length
,
"%z"
,
ptm
);
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
90b1527e
...
@@ -173,12 +173,12 @@ static void getNextTimeWindow(SInterval* pInterval, int32_t precision, int32_t o
...
@@ -173,12 +173,12 @@ static void getNextTimeWindow(SInterval* pInterval, int32_t precision, int32_t o
int
mon
=
(
int
)(
tm
.
tm_year
*
12
+
tm
.
tm_mon
+
interval
*
factor
);
int
mon
=
(
int
)(
tm
.
tm_year
*
12
+
tm
.
tm_mon
+
interval
*
factor
);
tm
.
tm_year
=
mon
/
12
;
tm
.
tm_year
=
mon
/
12
;
tm
.
tm_mon
=
mon
%
12
;
tm
.
tm_mon
=
mon
%
12
;
tw
->
skey
=
convertTimePrecision
((
int64_t
)
m
ktime
(
&
tm
)
*
1000L
,
TSDB_TIME_PRECISION_MILLI
,
precision
);
tw
->
skey
=
convertTimePrecision
((
int64_t
)
taosM
ktime
(
&
tm
)
*
1000L
,
TSDB_TIME_PRECISION_MILLI
,
precision
);
mon
=
(
int
)(
mon
+
interval
);
mon
=
(
int
)(
mon
+
interval
);
tm
.
tm_year
=
mon
/
12
;
tm
.
tm_year
=
mon
/
12
;
tm
.
tm_mon
=
mon
%
12
;
tm
.
tm_mon
=
mon
%
12
;
tw
->
ekey
=
convertTimePrecision
((
int64_t
)
m
ktime
(
&
tm
)
*
1000L
,
TSDB_TIME_PRECISION_MILLI
,
precision
);
tw
->
ekey
=
convertTimePrecision
((
int64_t
)
taosM
ktime
(
&
tm
)
*
1000L
,
TSDB_TIME_PRECISION_MILLI
,
precision
);
tw
->
ekey
-=
1
;
tw
->
ekey
-=
1
;
}
}
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
90b1527e
...
@@ -312,6 +312,8 @@ static int parseTime(char **end, SToken *pToken, int16_t timePrec, int64_t *time
...
@@ -312,6 +312,8 @@ static int parseTime(char **end, SToken *pToken, int16_t timePrec, int64_t *time
if
(
pToken
->
type
==
TK_NOW
)
{
if
(
pToken
->
type
==
TK_NOW
)
{
ts
=
taosGetTimestamp
(
timePrec
);
ts
=
taosGetTimestamp
(
timePrec
);
}
else
if
(
pToken
->
type
==
TK_TODAY
)
{
ts
=
taosGetTimestampToday
(
timePrec
);
}
else
if
(
pToken
->
type
==
TK_NK_INTEGER
)
{
}
else
if
(
pToken
->
type
==
TK_NK_INTEGER
)
{
bool
isSigned
=
false
;
bool
isSigned
=
false
;
toInteger
(
pToken
->
z
,
pToken
->
n
,
10
,
&
ts
,
&
isSigned
);
toInteger
(
pToken
->
z
,
pToken
->
n
,
10
,
&
ts
,
&
isSigned
);
...
@@ -376,8 +378,8 @@ static int parseTime(char **end, SToken *pToken, int16_t timePrec, int64_t *time
...
@@ -376,8 +378,8 @@ static int parseTime(char **end, SToken *pToken, int16_t timePrec, int64_t *time
}
}
static
FORCE_INLINE
int32_t
checkAndTrimValue
(
SToken
*
pToken
,
uint32_t
type
,
char
*
tmpTokenBuf
,
SMsgBuf
*
pMsgBuf
)
{
static
FORCE_INLINE
int32_t
checkAndTrimValue
(
SToken
*
pToken
,
uint32_t
type
,
char
*
tmpTokenBuf
,
SMsgBuf
*
pMsgBuf
)
{
if
((
pToken
->
type
!=
TK_NOW
&&
pToken
->
type
!=
TK_
NK_INTEGER
&&
pToken
->
type
!=
TK_NK_STRING
&&
pToken
->
type
!=
TK_NK_FLOAT
&&
pToken
->
type
!=
TK_NK_BOOL
&&
if
((
pToken
->
type
!=
TK_NOW
&&
pToken
->
type
!=
TK_
TODAY
&&
pToken
->
type
!=
TK_NK_INTEGER
&&
pToken
->
type
!=
TK_NK_STRING
&&
pToken
->
type
!=
TK_NK_FLOAT
&&
pToken
->
type
!=
TK_NULL
&&
pToken
->
type
!=
TK_NK_HEX
&&
pToken
->
type
!=
TK_NK_OCT
&&
pToken
->
type
!=
TK_NK_BIN
)
||
pToken
->
type
!=
TK_N
K_BOOL
&&
pToken
->
type
!=
TK_N
ULL
&&
pToken
->
type
!=
TK_NK_HEX
&&
pToken
->
type
!=
TK_NK_OCT
&&
pToken
->
type
!=
TK_NK_BIN
)
||
(
pToken
->
n
==
0
)
||
(
pToken
->
type
==
TK_NK_RP
))
{
(
pToken
->
n
==
0
)
||
(
pToken
->
type
==
TK_NK_RP
))
{
return
buildSyntaxErrMsg
(
pMsgBuf
,
"invalid data or symbol"
,
pToken
->
z
);
return
buildSyntaxErrMsg
(
pMsgBuf
,
"invalid data or symbol"
,
pToken
->
z
);
}
}
...
...
source/libs/scalar/src/sclfunc.c
浏览文件 @
90b1527e
...
@@ -841,7 +841,7 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam *
...
@@ -841,7 +841,7 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam *
memmove
(
fraction
,
fraction
+
TSDB_TIME_PRECISION_SEC_DIGITS
,
TSDB_TIME_PRECISION_SEC_DIGITS
);
memmove
(
fraction
,
fraction
+
TSDB_TIME_PRECISION_SEC_DIGITS
,
TSDB_TIME_PRECISION_SEC_DIGITS
);
}
}
struct
tm
*
tmInfo
=
localtime
((
const
time_t
*
)
&
timeVal
);
struct
tm
*
tmInfo
=
taosLocalTime
((
const
time_t
*
)
&
timeVal
,
NULL
);
strftime
(
buf
,
sizeof
(
buf
),
"%Y-%m-%dT%H:%M:%S%z"
,
tmInfo
);
strftime
(
buf
,
sizeof
(
buf
),
"%Y-%m-%dT%H:%M:%S%z"
,
tmInfo
);
int32_t
len
=
(
int32_t
)
strlen
(
buf
);
int32_t
len
=
(
int32_t
)
strlen
(
buf
);
...
...
source/os/src/osTime.c
浏览文件 @
90b1527e
...
@@ -406,7 +406,18 @@ FORCE_INLINE int32_t taosGetTimeOfDay(struct timeval *tv) {
...
@@ -406,7 +406,18 @@ FORCE_INLINE int32_t taosGetTimeOfDay(struct timeval *tv) {
#endif
#endif
}
}
time_t
taosTime
(
time_t
*
t
)
{
return
time
(
t
);
}
time_t
taosMktime
(
struct
tm
*
timep
)
{
return
mktime
(
timep
);
}
struct
tm
*
taosLocalTime
(
const
time_t
*
timep
,
struct
tm
*
result
)
{
struct
tm
*
taosLocalTime
(
const
time_t
*
timep
,
struct
tm
*
result
)
{
if
(
result
==
NULL
)
{
return
localtime
(
timep
);
}
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
localtime_s
(
result
,
timep
);
localtime_s
(
result
,
timep
);
#else
#else
...
...
tests/script/tsim/query/charScalarFunction.sim
浏览文件 @
90b1527e
...
@@ -266,20 +266,20 @@ if $data11 != NULL then
...
@@ -266,20 +266,20 @@ if $data11 != NULL then
return -1
return -1
endi
endi
print ====> select c2, c3 , concat(c2,c3) from ctb6
#
print ====> select c2, c3 , concat(c2,c3) from ctb6
sql select c2, c3 , concat(c2,c3) from ctb6
#
sql select c2, c3 , concat(c2,c3) from ctb6
print ====> rows: $rows
#
print ====> rows: $rows
print ====> $data00 $data01 $data02
#
print ====> $data00 $data01 $data02
print ====> $data10 $data11 $data12
#
print ====> $data10 $data11 $data12
if $rows != 2 then
#
if $rows != 2 then
return -1
#
return -1
endi
#
endi
if $data02 != 中文测试01中文测试01 then
#
if $data02 != 中文测试01中文测试01 then
return -1
#
return -1
endi
#
endi
if $data12 != NULL then
#
if $data12 != NULL then
return -1
#
return -1
endi
#
endi
print ====> select c2, c3 , concat(c2,c3) from ntb6
print ====> select c2, c3 , concat(c2,c3) from ntb6
sql select c2, c3 , concat(c2,c3) from ntb6
sql select c2, c3 , concat(c2,c3) from ntb6
...
@@ -304,12 +304,12 @@ print ====> $data10 $data11 $data12
...
@@ -304,12 +304,12 @@ print ====> $data10 $data11 $data12
if $rows != 2 then
if $rows != 2 then
return -1
return -1
endi
endi
if $data02 != 中文测试01_中文测试01 then
if $data02 != 中文测试1_中文测试2 then
return -1
endi
if $data12 != NULL then
return -1
return -1
endi
endi
# if $data12 != NULL then
# return -1
# endi
print ====> select c2, c3 , concat_ws('_', c2, c3) from ntb6
print ====> select c2, c3 , concat_ws('_', c2, c3) from ntb6
sql select c2, c3 , concat_ws('_', c2, c3) from ntb6
sql select c2, c3 , concat_ws('_', c2, c3) from ntb6
...
@@ -322,40 +322,40 @@ endi
...
@@ -322,40 +322,40 @@ endi
if $data02 != 中文测试01_中文测试01 then
if $data02 != 中文测试01_中文测试01 then
return -1
return -1
endi
endi
if $data12 != NULL then
#
if $data12 != NULL then
return -1
#
return -1
endi
#
endi
print ====> select c2, substr(c2,1, 4) from ctb6
print ====> select c2, substr(c2,1, 4) from ctb6
sql select c2, substr(c2,1, 4) from ctb6
sql select c2, substr(c2,1, 4) from ctb6
print ====> rows: $rows
print ====> rows: $rows
print ====> $data00 $data01
$data02
print ====> $data00 $data01
print ====> $data10 $data11
$data12
print ====> $data10 $data11
if $rows != 2 then
if $rows != 2 then
return -1
return -1
endi
endi
if $data0
1 != 中文测试0
1 then
if $data0
0 != 中文测试
1 then
return -1
return -1
endi
endi
if $data02 != 中文测试01 then
if $data01 != 中文测试 then
return -1
endi
if $data11 != NULL then
return -1
return -1
endi
endi
# if $data11 != NULL then
# return -1
# endi
print ====> select c2, substr(c2,1, 4) from ntb6
print ====> select c2, substr(c2,1, 4) from ntb6
sql select c2, substr(c2,1, 4) from ntb6
sql select c2, substr(c2,1, 4) from ntb6
print ====> rows: $rows
print ====> rows: $rows
print ====> $data00 $data01
$data02
print ====> $data00 $data01
print ====> $data10 $data11
$data12
print ====> $data10 $data11
if $rows != 2 then
if $rows != 2 then
return -1
return -1
endi
endi
if $data0
1
!= 中文测试01 then
if $data0
0
!= 中文测试01 then
return -1
return -1
endi
endi
if $data0
2 != 中文测试01
then
if $data0
1 != 中文测试
then
return -1
return -1
endi
endi
if $data11 != NULL then
if $data11 != NULL then
...
...
tests/tsim/src/simExe.c
浏览文件 @
90b1527e
...
@@ -678,7 +678,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
...
@@ -678,7 +678,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
if
(
tt
<
0
)
tt
=
0
;
if
(
tt
<
0
)
tt
=
0
;
#endif
#endif
tp
=
localtime
(
&
tt
);
tp
=
taosLocalTime
(
&
tt
,
NULL
);
strftime
(
timeStr
,
64
,
"%y-%m-%d %H:%M:%S"
,
tp
);
strftime
(
timeStr
,
64
,
"%y-%m-%d %H:%M:%S"
,
tp
);
if
(
precision
==
TSDB_TIME_PRECISION_MILLI
)
{
if
(
precision
==
TSDB_TIME_PRECISION_MILLI
)
{
sprintf
(
value
,
"%s.%03d"
,
timeStr
,
(
int32_t
)(
*
((
int64_t
*
)
row
[
i
])
%
1000
));
sprintf
(
value
,
"%s.%03d"
,
timeStr
,
(
int32_t
)(
*
((
int64_t
*
)
row
[
i
])
%
1000
));
...
...
tools/shell/src/shellEngine.c
浏览文件 @
90b1527e
...
@@ -452,7 +452,7 @@ static char *formatTimestamp(char *buf, int64_t val, int precision) {
...
@@ -452,7 +452,7 @@ static char *formatTimestamp(char *buf, int64_t val, int precision) {
}
}
}
}
struct
tm
*
ptm
=
localtime
(
&
tt
);
struct
tm
*
ptm
=
taosLocalTime
(
&
tt
,
NULL
);
size_t
pos
=
strftime
(
buf
,
35
,
"%Y-%m-%d %H:%M:%S"
,
ptm
);
size_t
pos
=
strftime
(
buf
,
35
,
"%Y-%m-%d %H:%M:%S"
,
ptm
);
if
(
precision
==
TSDB_TIME_PRECISION_NANO
)
{
if
(
precision
==
TSDB_TIME_PRECISION_NANO
)
{
...
...
tools/taosTools-1.4.1-Linux-x64.tar.gz
0 → 100644
浏览文件 @
90b1527e
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录