Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
~笨蛋陪你哭
TDengine
提交
4a25ad2b
T
TDengine
项目概览
~笨蛋陪你哭
/
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,发现更多精彩内容 >>
提交
4a25ad2b
编写于
8月 05, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1057
上级
f790003e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
52 addition
and
25 deletion
+52
-25
src/client/src/taos.def
src/client/src/taos.def
+0
-1
src/client/src/tscFunctionImpl.c
src/client/src/tscFunctionImpl.c
+13
-13
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+11
-11
src/os/inc/osWindows.h
src/os/inc/osWindows.h
+3
-0
src/os/src/windows/w64String.c
src/os/src/windows/w64String.c
+25
-0
未找到文件。
src/client/src/taos.def
浏览文件 @
4a25ad2b
...
...
@@ -4,7 +4,6 @@ taos_options
taos_connect
taos_close
taos_query
taos_use_result
taos_fetch_row
taos_free_result
taos_field_count
...
...
src/client/src/tscFunctionImpl.c
浏览文件 @
4a25ad2b
...
...
@@ -947,11 +947,11 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin,
if
(
pCtx
->
inputType
==
TSDB_DATA_TYPE_TINYINT
)
{
int8_t
*
data
=
(
int8_t
*
)
pOutput
;
UPDATE_DATA
(
pCtx
,
*
data
,
val
,
notNullElems
,
isMin
,
key
);
UPDATE_DATA
(
pCtx
,
*
data
,
(
int8_t
)
val
,
notNullElems
,
isMin
,
key
);
}
else
if
(
pCtx
->
inputType
==
TSDB_DATA_TYPE_SMALLINT
)
{
int16_t
*
data
=
(
int16_t
*
)
pOutput
;
UPDATE_DATA
(
pCtx
,
*
data
,
val
,
notNullElems
,
isMin
,
key
);
UPDATE_DATA
(
pCtx
,
*
data
,
(
int16_t
)
val
,
notNullElems
,
isMin
,
key
);
}
else
if
(
pCtx
->
inputType
==
TSDB_DATA_TYPE_INT
)
{
int32_t
*
data
=
(
int32_t
*
)
pOutput
;
#if defined(_DEBUG_VIEW)
...
...
@@ -959,7 +959,7 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin,
#endif
if
((
*
data
<
val
)
^
isMin
)
{
*
data
=
val
;
*
data
=
(
int32_t
)
val
;
for
(
int32_t
i
=
0
;
i
<
(
pCtx
)
->
tagInfo
.
numOfTagCols
;
++
i
)
{
SQLFunctionCtx
*
__ctx
=
pCtx
->
tagInfo
.
pTagCtxList
[
i
];
if
(
__ctx
->
functionId
==
TSDB_FUNC_TS_DUMMY
)
{
...
...
@@ -982,7 +982,7 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin,
float
*
data
=
(
float
*
)
pOutput
;
double
val
=
GET_DOUBLE_VAL
(
tval
);
UPDATE_DATA
(
pCtx
,
*
data
,
val
,
notNullElems
,
isMin
,
key
);
UPDATE_DATA
(
pCtx
,
*
data
,
(
float
)
val
,
notNullElems
,
isMin
,
key
);
}
return
;
...
...
@@ -2040,7 +2040,7 @@ static void copyTopBotRes(SQLFunctionCtx *pCtx, int32_t type) {
case
TSDB_DATA_TYPE_INT
:
{
int32_t
*
output
=
(
int32_t
*
)
pCtx
->
aOutputBuf
;
for
(
int32_t
i
=
0
;
i
<
len
;
++
i
,
output
+=
step
)
{
*
output
=
tvp
[
i
]
->
v
.
i64Key
;
*
output
=
(
int32_t
)
tvp
[
i
]
->
v
.
i64Key
;
}
break
;
}
...
...
@@ -2061,21 +2061,21 @@ static void copyTopBotRes(SQLFunctionCtx *pCtx, int32_t type) {
case
TSDB_DATA_TYPE_FLOAT
:
{
float
*
output
=
(
float
*
)
pCtx
->
aOutputBuf
;
for
(
int32_t
i
=
0
;
i
<
len
;
++
i
,
output
+=
step
)
{
*
output
=
tvp
[
i
]
->
v
.
dKey
;
*
output
=
(
float
)
tvp
[
i
]
->
v
.
dKey
;
}
break
;
}
case
TSDB_DATA_TYPE_SMALLINT
:
{
int16_t
*
output
=
(
int16_t
*
)
pCtx
->
aOutputBuf
;
for
(
int32_t
i
=
0
;
i
<
len
;
++
i
,
output
+=
step
)
{
*
output
=
tvp
[
i
]
->
v
.
i64Key
;
*
output
=
(
int16_t
)
tvp
[
i
]
->
v
.
i64Key
;
}
break
;
}
case
TSDB_DATA_TYPE_TINYINT
:
{
int8_t
*
output
=
(
int8_t
*
)
pCtx
->
aOutputBuf
;
for
(
int32_t
i
=
0
;
i
<
len
;
++
i
,
output
+=
step
)
{
*
output
=
tvp
[
i
]
->
v
.
i64Key
;
*
output
=
(
int8_t
)
tvp
[
i
]
->
v
.
i64Key
;
}
break
;
}
...
...
@@ -2430,7 +2430,7 @@ static bool percentile_function_setup(SQLFunctionCtx *pCtx) {
}
SResultInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
SSchema
field
[
1
]
=
{
{
pCtx
->
inputType
,
"dummyCol"
,
0
,
(
uint8_t
)
pCtx
->
inputBytes
}
};
SSchema
field
[
1
]
=
{
{
(
uint8_t
)
pCtx
->
inputType
,
"dummyCol"
,
0
,
pCtx
->
inputBytes
}
};
SColumnModel
*
pModel
=
createColumnModel
(
field
,
1
,
1000
);
int32_t
orderIdx
=
0
;
...
...
@@ -2875,7 +2875,7 @@ static void leastsquares_finalizer(SQLFunctionCtx *pCtx) {
double
(
*
param
)[
3
]
=
pInfo
->
mat
;
param
[
1
][
1
]
=
pInfo
->
num
;
param
[
1
][
1
]
=
(
double
)
pInfo
->
num
;
param
[
1
][
0
]
=
param
[
0
][
1
];
param
[
0
][
0
]
-=
param
[
1
][
0
]
*
(
param
[
0
][
1
]
/
param
[
1
][
1
]);
...
...
@@ -3335,10 +3335,10 @@ static void arithmetic_function_f(SQLFunctionCtx *pCtx, int32_t index) {
continue; \
} \
if (inputData[i] < minOutput) { \
minOutput = inputData[i]; \
minOutput =
(double)
inputData[i]; \
} \
if (inputData[i] > maxOutput) { \
maxOutput = inputData[i]; \
maxOutput =
(double)
inputData[i]; \
} \
numOfNotNullElem++; \
} \
...
...
@@ -3456,7 +3456,7 @@ static void spread_function_f(SQLFunctionCtx *pCtx, int32_t index) {
}
else
if
(
pCtx
->
inputType
==
TSDB_DATA_TYPE_INT
)
{
val
=
GET_INT32_VAL
(
pData
);
}
else
if
(
pCtx
->
inputType
==
TSDB_DATA_TYPE_BIGINT
||
pCtx
->
inputType
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
val
=
GET_INT64_VAL
(
pData
);
val
=
(
double
)(
GET_INT64_VAL
(
pData
)
);
}
else
if
(
pCtx
->
inputType
==
TSDB_DATA_TYPE_DOUBLE
)
{
val
=
GET_DOUBLE_VAL
(
pData
);
}
else
if
(
pCtx
->
inputType
==
TSDB_DATA_TYPE_FLOAT
)
{
...
...
src/client/src/tscLocal.c
浏览文件 @
4a25ad2b
...
...
@@ -223,12 +223,12 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols,
rowLen
+=
((
TSDB_COL_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
);
f
.
bytes
=
typeColLength
+
VARSTR_HEADER_SIZE
;
f
.
bytes
=
(
int16_t
)(
typeColLength
+
VARSTR_HEADER_SIZE
)
;
f
.
type
=
TSDB_DATA_TYPE_BINARY
;
tstrncpy
(
f
.
name
,
"Type"
,
sizeof
(
f
.
name
));
pInfo
=
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
pInfo
->
pSqlExpr
=
tscSqlExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
index
,
TSDB_DATA_TYPE_BINARY
,
typeColLength
+
VARSTR_HEADER_SIZE
,
pInfo
->
pSqlExpr
=
tscSqlExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
index
,
TSDB_DATA_TYPE_BINARY
,
(
int16_t
)(
typeColLength
+
VARSTR_HEADER_SIZE
)
,
typeColLength
,
false
);
rowLen
+=
typeColLength
+
VARSTR_HEADER_SIZE
;
...
...
@@ -243,12 +243,12 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols,
rowLen
+=
sizeof
(
int32_t
);
f
.
bytes
=
noteColLength
+
VARSTR_HEADER_SIZE
;
f
.
bytes
=
(
int16_t
)(
noteColLength
+
VARSTR_HEADER_SIZE
)
;
f
.
type
=
TSDB_DATA_TYPE_BINARY
;
tstrncpy
(
f
.
name
,
"Note"
,
sizeof
(
f
.
name
));
pInfo
=
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
pInfo
->
pSqlExpr
=
tscSqlExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
index
,
TSDB_DATA_TYPE_BINARY
,
noteColLength
+
VARSTR_HEADER_SIZE
,
pInfo
->
pSqlExpr
=
tscSqlExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
index
,
TSDB_DATA_TYPE_BINARY
,
(
int16_t
)(
noteColLength
+
VARSTR_HEADER_SIZE
)
,
noteColLength
,
false
);
rowLen
+=
noteColLength
+
VARSTR_HEADER_SIZE
;
...
...
@@ -305,7 +305,7 @@ static void tscProcessCurrentDB(SSqlObj *pSql) {
if
(
t
==
0
)
{
setVardataNull
(
vx
,
TSDB_DATA_TYPE_BINARY
);
}
else
{
STR_WITH_SIZE_TO_VARSTR
(
vx
,
db
,
t
);
STR_WITH_SIZE_TO_VARSTR
(
vx
,
db
,
(
VarDataLenT
)
t
);
}
tscSetLocalQueryResult
(
pSql
,
vx
,
pExpr
->
aliasName
,
pExpr
->
resType
,
pExpr
->
resBytes
);
...
...
@@ -320,10 +320,10 @@ static void tscProcessServerVer(SSqlObj *pSql) {
pExpr
->
resType
=
TSDB_DATA_TYPE_BINARY
;
size_t
t
=
strlen
(
v
);
pExpr
->
resBytes
=
t
+
VARSTR_HEADER_SIZE
;
pExpr
->
resBytes
=
(
int16_t
)(
t
+
VARSTR_HEADER_SIZE
)
;
char
*
vx
=
calloc
(
1
,
pExpr
->
resBytes
);
STR_WITH_SIZE_TO_VARSTR
(
vx
,
v
,
t
);
STR_WITH_SIZE_TO_VARSTR
(
vx
,
v
,
(
VarDataLenT
)
t
);
tscSetLocalQueryResult
(
pSql
,
vx
,
pExpr
->
aliasName
,
pExpr
->
resType
,
pExpr
->
resBytes
);
taosTFree
(
vx
);
...
...
@@ -336,10 +336,10 @@ static void tscProcessClientVer(SSqlObj *pSql) {
pExpr
->
resType
=
TSDB_DATA_TYPE_BINARY
;
size_t
t
=
strlen
(
version
);
pExpr
->
resBytes
=
t
+
VARSTR_HEADER_SIZE
;
pExpr
->
resBytes
=
(
int16_t
)(
t
+
VARSTR_HEADER_SIZE
)
;
char
*
v
=
calloc
(
1
,
pExpr
->
resBytes
);
STR_WITH_SIZE_TO_VARSTR
(
v
,
version
,
t
);
STR_WITH_SIZE_TO_VARSTR
(
v
,
version
,
(
VarDataLenT
)
t
);
tscSetLocalQueryResult
(
pSql
,
v
,
pExpr
->
aliasName
,
pExpr
->
resType
,
pExpr
->
resBytes
);
taosTFree
(
v
);
...
...
@@ -379,10 +379,10 @@ void tscSetLocalQueryResult(SSqlObj *pSql, const char *val, const char *columnNa
pQueryInfo
->
fieldsInfo
.
pFields
=
taosArrayInit
(
1
,
sizeof
(
TAOS_FIELD
));
pQueryInfo
->
fieldsInfo
.
pSupportInfo
=
taosArrayInit
(
1
,
sizeof
(
SFieldSupInfo
));
TAOS_FIELD
f
=
tscCreateField
(
type
,
columnName
,
valueLength
);
TAOS_FIELD
f
=
tscCreateField
(
(
int8_t
)
type
,
columnName
,
(
int16_t
)
valueLength
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
tscInitResObjForLocalQuery
(
pSql
,
1
,
valueLength
);
tscInitResObjForLocalQuery
(
pSql
,
1
,
(
int32_t
)
valueLength
);
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
0
);
SFieldSupInfo
*
pInfo
=
tscFieldInfoGetSupp
(
&
pQueryInfo
->
fieldsInfo
,
0
);
...
...
src/os/inc/osWindows.h
浏览文件 @
4a25ad2b
...
...
@@ -107,6 +107,9 @@ typedef SOCKET eventfd_t;
#define taosStrdupImp(str) _strdup(str)
#define taosStrndupImp(str, size) _strndup(str, size)
char
*
stpcpy
(
char
*
dest
,
const
char
*
src
);
char
*
stpncpy
(
char
*
dest
,
const
char
*
src
,
size_t
n
);
#define TAOS_OS_FUNC_SYSINFO
#define TAOS_OS_FUNC_TIME_DEF
...
...
src/os/src/windows/w64String.c
浏览文件 @
4a25ad2b
...
...
@@ -129,3 +129,28 @@ int tasoUcs4Compare(void *f1_ucs4, void *f2_ucs4, int bytes) {
return ret;
#endif
}
/* Copy memory to memory until the specified number of bytes
has been copied, return pointer to following byte.
Overlap is NOT handled correctly. */
void
*
mempcpy
(
void
*
dest
,
const
void
*
src
,
size_t
len
)
{
return
(
char
*
)
memcpy
(
dest
,
src
,
len
)
+
len
;
}
/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
char
*
stpcpy
(
char
*
dest
,
const
char
*
src
)
{
size_t
len
=
strlen
(
src
);
return
(
char
*
)
memcpy
(
dest
,
src
,
len
+
1
)
+
len
;
}
/* Copy no more than N characters of SRC to DEST, returning the address of
the terminating '\0' in DEST, if any, or else DEST + N. */
char
*
stpncpy
(
char
*
dest
,
const
char
*
src
,
size_t
n
)
{
size_t
size
=
strnlen
(
src
,
n
);
memcpy
(
dest
,
src
,
size
);
dest
+=
size
;
if
(
size
==
n
)
return
dest
;
return
memset
(
dest
,
'\0'
,
n
-
size
);
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录