Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
819c7fc0
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
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看板
提交
819c7fc0
编写于
10月 08, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-10529] fix compiler error
上级
885380a1
变更
89
展开全部
隐藏空白更改
内联
并排
Showing
89 changed file
with
437 addition
and
1256 deletion
+437
-1256
include/client/taos.h
include/client/taos.h
+0
-0
include/common/common.h
include/common/common.h
+15
-15
include/common/taosmsg.h
include/common/taosmsg.h
+2
-0
include/common/tdataformat.h
include/common/tdataformat.h
+1
-1
include/common/texpr.h
include/common/texpr.h
+0
-107
include/common/ttoken.h
include/common/ttoken.h
+0
-192
include/common/tvariant.h
include/common/tvariant.h
+23
-22
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+1
-0
include/libs/parser/parser.h
include/libs/parser/parser.h
+14
-14
include/libs/transport/transport.h
include/libs/transport/transport.h
+15
-17
include/util/tcompression.h
include/util/tcompression.h
+0
-0
include/util/tdef.h
include/util/tdef.h
+34
-39
include/util/tutil.h
include/util/tutil.h
+2
-2
source/common/src/tarithoperator.c
source/common/src/tarithoperator.c
+0
-412
source/common/src/tcompare.c
source/common/src/tcompare.c
+2
-2
source/common/src/tname.c
source/common/src/tname.c
+33
-64
source/common/src/ttypes.c
source/common/src/ttypes.c
+2
-2
source/common/src/tvariant.c
source/common/src/tvariant.c
+57
-55
source/libs/executor/CMakeLists.txt
source/libs/executor/CMakeLists.txt
+5
-0
source/libs/executor/src/tarithoperator.h
source/libs/executor/src/tarithoperator.h
+0
-32
source/libs/executor/src/texpr.c
source/libs/executor/src/texpr.c
+19
-20
source/libs/parser/inc/tvariant.h
source/libs/parser/inc/tvariant.h
+0
-66
source/libs/parser/src/astGenerator.c
source/libs/parser/src/astGenerator.c
+2
-2
source/libs/parser/src/ttokenizer.c
source/libs/parser/src/ttokenizer.c
+7
-9
source/libs/planner/inc/plannerInt.h
source/libs/planner/inc/plannerInt.h
+1
-0
source/libs/transport/src/rpcMain.c
source/libs/transport/src/rpcMain.c
+1
-1
source/server/dnode/inc/dnodeEps.h
source/server/dnode/inc/dnodeEps.h
+1
-1
source/server/dnode/src/dnodeMain.c
source/server/dnode/src/dnodeMain.c
+3
-3
source/util/src/tcache.c
source/util/src/tcache.c
+5
-4
source/util/src/tcompression.c
source/util/src/tcompression.c
+1
-1
source/util/src/thash.c
source/util/src/thash.c
+1
-0
source/util/src/thashutil.c
source/util/src/thashutil.c
+12
-13
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-1
src/client/src/TSDBJNIConnector.c
src/client/src/TSDBJNIConnector.c
+1
-1
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+3
-3
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+1
-1
src/client/src/tscParseOpenTSDB.c
src/client/src/tscParseOpenTSDB.c
+1
-1
src/client/src/tscPrepare.c
src/client/src/tscPrepare.c
+5
-5
src/client/src/tscProfile.c
src/client/src/tscProfile.c
+1
-1
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+26
-4
src/client/src/tscSub.c
src/client/src/tscSub.c
+5
-5
src/connector/odbc/examples/c/main.c
src/connector/odbc/examples/c/main.c
+1
-1
src/connector/odbc/src/base.h
src/connector/odbc/src/base.h
+1
-1
src/connector/odbc/src/todbc_tls.h
src/connector/odbc/src/todbc_tls.h
+1
-1
src/cq/src/cqMain.c
src/cq/src/cqMain.c
+3
-3
src/kit/shell/inc/shell.h
src/kit/shell/inc/shell.h
+1
-2
src/kit/shell/src/shellWindows.c
src/kit/shell/src/shellWindows.c
+1
-1
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+2
-2
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+1
-2
src/plugins/http/inc/httpGcJson.h
src/plugins/http/inc/httpGcJson.h
+1
-1
src/plugins/http/inc/httpRestJson.h
src/plugins/http/inc/httpRestJson.h
+1
-1
src/plugins/http/inc/httpTgJson.h
src/plugins/http/inc/httpTgJson.h
+1
-1
src/plugins/http/src/httpQueue.c
src/plugins/http/src/httpQueue.c
+9
-9
src/plugins/http/src/httpSession.c
src/plugins/http/src/httpSession.c
+5
-5
src/plugins/http/src/httpSql.c
src/plugins/http/src/httpSql.c
+9
-9
src/plugins/http/src/httpSystem.c
src/plugins/http/src/httpSystem.c
+12
-12
src/plugins/http/src/httpUtil.c
src/plugins/http/src/httpUtil.c
+4
-4
src/plugins/mqtt/src/mqttSystem.c
src/plugins/mqtt/src/mqttSystem.c
+4
-4
src/query/inc/qSqlparser.h
src/query/inc/qSqlparser.h
+1
-1
src/query/src/qExtbuffer.c
src/query/src/qExtbuffer.c
+4
-4
tests/comparisonTest/tdengine/tdengineTest.c
tests/comparisonTest/tdengine/tdengineTest.c
+6
-6
tests/examples/c/apitest.c
tests/examples/c/apitest.c
+1
-2
tests/examples/c/asyncdemo.c
tests/examples/c/asyncdemo.c
+1
-1
tests/examples/c/demo.c
tests/examples/c/demo.c
+2
-2
tests/examples/c/prepare.c
tests/examples/c/prepare.c
+1
-2
tests/examples/c/schemaless.c
tests/examples/c/schemaless.c
+2
-2
tests/examples/c/stream.c
tests/examples/c/stream.c
+2
-2
tests/examples/c/subscribe.c
tests/examples/c/subscribe.c
+1
-1
tests/examples/lua/lua51/lua_connector51.c
tests/examples/lua/lua51/lua_connector51.c
+3
-3
tests/examples/lua/lua_connector.c
tests/examples/lua/lua_connector.c
+5
-5
tests/robust/robust.c
tests/robust/robust.c
+2
-2
tests/script/api/batchprepare.c
tests/script/api/batchprepare.c
+2
-2
tests/script/api/stmtBatchTest.c
tests/script/api/stmtBatchTest.c
+3
-3
tests/script/api/stmtTest.c
tests/script/api/stmtTest.c
+2
-2
tests/script/api/stmt_function.c
tests/script/api/stmt_function.c
+3
-3
tests/test/c/cacheTest.c
tests/test/c/cacheTest.c
+1
-1
tests/test/c/createNormalTable.c
tests/test/c/createNormalTable.c
+3
-3
tests/test/c/createTablePerformance.c
tests/test/c/createTablePerformance.c
+3
-3
tests/test/c/hashIterator.c
tests/test/c/hashIterator.c
+2
-2
tests/test/c/hashPerformance.c
tests/test/c/hashPerformance.c
+2
-2
tests/test/c/importOneRow.c
tests/test/c/importOneRow.c
+3
-3
tests/test/c/importPerTable.c
tests/test/c/importPerTable.c
+4
-4
tests/test/c/insertPerRow.c
tests/test/c/insertPerRow.c
+3
-3
tests/test/c/insertPerTable.c
tests/test/c/insertPerTable.c
+3
-3
tests/test/c/invalidTableId.c
tests/test/c/invalidTableId.c
+3
-3
tests/test/c/queryPerformance.c
tests/test/c/queryPerformance.c
+3
-3
tests/tsim/inc/sim.h
tests/tsim/inc/sim.h
+1
-1
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+2
-2
tests/tsim/src/simSystem.c
tests/tsim/src/simSystem.c
+3
-3
未找到文件。
include/c
ommon
/taos.h
→
include/c
lient
/taos.h
浏览文件 @
819c7fc0
文件已移动
include/common/common.h
浏览文件 @
819c7fc0
...
...
@@ -18,22 +18,22 @@
#include "taosdef.h"
typedef
struct
STimeWindow
{
TSKEY
skey
;
TSKEY
ekey
;
}
STimeWindow
;
//
typedef struct STimeWindow {
//
TSKEY skey;
//
TSKEY ekey;
//
} STimeWindow;
typedef
struct
{
int32_t
dataLen
;
char
name
[
TSDB_TABLE_FNAME_LEN
];
char
*
data
;
}
STagData
;
//
typedef struct {
//
int32_t dataLen;
//
char name[TSDB_TABLE_FNAME_LEN];
//
char *data;
//
} STagData;
typedef
struct
SSchema
{
uint8_t
type
;
char
name
[
TSDB_COL_NAME_LEN
];
int16_t
colId
;
int16_t
bytes
;
}
SSchema
;
//
typedef struct SSchema {
//
uint8_t type;
//
char name[TSDB_COL_NAME_LEN];
//
int16_t colId;
//
int16_t bytes;
//
} SSchema;
#endif // TDENGINE_COMMON_H
include/common/taosmsg.h
浏览文件 @
819c7fc0
...
...
@@ -252,12 +252,14 @@ typedef struct {
SShellSubmitRspBlock
failedBlocks
[];
}
SShellSubmitRspMsg
;
//#if 0
typedef
struct
SSchema
{
uint8_t
type
;
char
name
[
TSDB_COL_NAME_LEN
];
int16_t
colId
;
int16_t
bytes
;
}
SSchema
;
//#endif
typedef
struct
{
int32_t
contLen
;
...
...
include/common/tdataformat.h
浏览文件 @
819c7fc0
...
...
@@ -17,7 +17,7 @@
#include "os.h"
#include "talgo.h"
#include "ttype.h"
#include "ttype
s
.h"
#include "tutil.h"
#ifdef __cplusplus
...
...
include/common/texpr.h
已删除
100644 → 0
浏览文件 @
885380a1
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_COMMON_EXPR_H_
#define _TD_COMMON_EXPR_H_
#ifdef __cplusplus
extern
"C"
{
#endif
#include "os.h"
#include "taosmsg.h"
#include "taosdef.h"
#include "tskiplist.h"
#include "tbuffer.h"
#include "tvariant.h"
struct
tExprNode
;
struct
SSchema
;
#define QUERY_COND_REL_PREFIX_IN "IN|"
#define QUERY_COND_REL_PREFIX_LIKE "LIKE|"
#define QUERY_COND_REL_PREFIX_MATCH "MATCH|"
#define QUERY_COND_REL_PREFIX_NMATCH "NMATCH|"
#define QUERY_COND_REL_PREFIX_IN_LEN 3
#define QUERY_COND_REL_PREFIX_LIKE_LEN 5
#define QUERY_COND_REL_PREFIX_MATCH_LEN 6
#define QUERY_COND_REL_PREFIX_NMATCH_LEN 7
typedef
bool
(
*
__result_filter_fn_t
)(
const
void
*
,
void
*
);
typedef
void
(
*
__do_filter_suppl_fn_t
)(
void
*
,
void
*
);
enum
{
TSQL_NODE_DUMMY
=
0x0
,
TSQL_NODE_EXPR
=
0x1
,
TSQL_NODE_COL
=
0x2
,
TSQL_NODE_VALUE
=
0x4
,
};
/**
* this structure is used to filter data in tags, so the offset of filtered tag column in tagdata string is required
*/
typedef
struct
tQueryInfo
{
uint8_t
optr
;
// expression operator
SSchema
sch
;
// schema of tags
char
*
q
;
__compar_fn_t
compare
;
// filter function
bool
indexed
;
// indexed columns
}
tQueryInfo
;
typedef
struct
tExprNode
{
uint8_t
nodeType
;
union
{
struct
{
uint8_t
optr
;
// filter operator
uint8_t
hasPK
;
// 0: do not contain primary filter, 1: contain
void
*
info
;
// support filter operation on this expression only available for leaf node
struct
tExprNode
*
pLeft
;
// left child pointer
struct
tExprNode
*
pRight
;
// right child pointer
}
_node
;
struct
SSchema
*
pSchema
;
tVariant
*
pVal
;
};
}
tExprNode
;
typedef
struct
SExprTraverseSupp
{
__result_filter_fn_t
nodeFilterFn
;
__do_filter_suppl_fn_t
setupInfoFn
;
void
*
pExtInfo
;
}
SExprTraverseSupp
;
void
tExprTreeDestroy
(
tExprNode
*
pNode
,
void
(
*
fp
)(
void
*
));
void
exprTreeToBinary
(
SBufferWriter
*
bw
,
tExprNode
*
pExprTree
);
tExprNode
*
exprTreeFromBinary
(
const
void
*
data
,
size_t
size
);
tExprNode
*
exprTreeFromTableName
(
const
char
*
tbnameCond
);
tExprNode
*
exprdup
(
tExprNode
*
pTree
);
void
exprTreeToBinary
(
SBufferWriter
*
bw
,
tExprNode
*
pExprTree
);
bool
exprTreeApplyFilter
(
tExprNode
*
pExpr
,
const
void
*
pItem
,
SExprTraverseSupp
*
param
);
void
arithmeticTreeTraverse
(
tExprNode
*
pExprs
,
int32_t
numOfRows
,
char
*
pOutput
,
void
*
param
,
int32_t
order
,
char
*
(
*
cb
)(
void
*
,
const
char
*
,
int32_t
));
void
buildFilterSetFromBinary
(
void
**
q
,
const
char
*
buf
,
int32_t
len
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_COMMON_EXPR_H_*/
include/common/ttoken.h
已删除
100644 → 0
浏览文件 @
885380a1
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_COMMON_TOKEN_H_
#define _TD_COMMON_TOKEN_H_
#ifdef __cplusplus
extern
"C"
{
#endif
#include "os.h"
#include "tutil.h"
#include "ttokendef.h"
#define TSQL_TBNAME "TBNAME"
#define TSQL_TBNAME_L "tbname"
#define TSQL_BLOCK_DIST "_BLOCK_DIST"
#define TSQL_BLOCK_DIST_L "_block_dist"
// used to denote the minimum unite in sql parsing
typedef
struct
SStrToken
{
uint32_t
n
;
uint32_t
type
;
char
*
z
;
}
SStrToken
;
/**
* check if it is a number or not
* @param pToken
* @return
*/
#define isNumber(tk) \
((tk)->type == TK_INTEGER || (tk)->type == TK_FLOAT || (tk)->type == TK_HEX || (tk)->type == TK_BIN)
/**
* tokenizer for sql string
* @param z
* @param tokenType
* @return
*/
uint32_t
tGetToken
(
char
*
z
,
uint32_t
*
tokenType
);
/**
* enhanced tokenizer for sql string.
*
* @param str
* @param i
* @param isPrevOptr
* @return
*/
SStrToken
tStrGetToken
(
char
*
str
,
int32_t
*
i
,
bool
isPrevOptr
);
/**
* check if it is a keyword or not
* @param z
* @param len
* @return
*/
bool
taosIsKeyWordToken
(
const
char
*
z
,
int32_t
len
);
/**
* check if it is a token or not
* @param pToken
* @return token type, if it is not a number, TK_ILLEGAL will return
*/
static
FORCE_INLINE
int32_t
tGetNumericStringType
(
const
SStrToken
*
pToken
)
{
const
char
*
z
=
pToken
->
z
;
int32_t
type
=
TK_ILLEGAL
;
uint32_t
i
=
0
;
for
(;
i
<
pToken
->
n
;
++
i
)
{
switch
(
z
[
i
])
{
case
'+'
:
case
'-'
:
{
break
;
}
case
'.'
:
{
/*
* handle the the float number with out integer part
* .123
* .123e4
*/
if
(
!
isdigit
(
z
[
i
+
1
]))
{
return
TK_ILLEGAL
;
}
for
(
i
+=
2
;
isdigit
(
z
[
i
]);
i
++
)
{
}
if
((
z
[
i
]
==
'e'
||
z
[
i
]
==
'E'
)
&&
(
isdigit
(
z
[
i
+
1
])
||
((
z
[
i
+
1
]
==
'+'
||
z
[
i
+
1
]
==
'-'
)
&&
isdigit
(
z
[
i
+
2
]))))
{
i
+=
2
;
while
(
isdigit
(
z
[
i
]))
{
i
++
;
}
}
type
=
TK_FLOAT
;
goto
_end
;
}
case
'0'
:
{
char
next
=
z
[
i
+
1
];
if
(
next
==
'b'
)
{
// bin number
type
=
TK_BIN
;
for
(
i
+=
2
;
(
z
[
i
]
==
'0'
||
z
[
i
]
==
'1'
);
++
i
)
{
}
goto
_end
;
}
else
if
(
next
==
'x'
)
{
//hex number
type
=
TK_HEX
;
for
(
i
+=
2
;
isdigit
(
z
[
i
])
||
(
z
[
i
]
>=
'a'
&&
z
[
i
]
<=
'f'
)
||
(
z
[
i
]
>=
'A'
&&
z
[
i
]
<=
'F'
);
++
i
)
{
}
goto
_end
;
}
}
case
'1'
:
case
'2'
:
case
'3'
:
case
'4'
:
case
'5'
:
case
'6'
:
case
'7'
:
case
'8'
:
case
'9'
:
{
type
=
TK_INTEGER
;
for
(;
isdigit
(
z
[
i
]);
i
++
)
{
}
int32_t
seg
=
0
;
while
(
z
[
i
]
==
'.'
&&
isdigit
(
z
[
i
+
1
]))
{
i
+=
2
;
while
(
isdigit
(
z
[
i
]))
{
i
++
;
}
seg
++
;
type
=
TK_FLOAT
;
}
if
(
seg
>
1
)
{
return
TK_ILLEGAL
;
}
if
((
z
[
i
]
==
'e'
||
z
[
i
]
==
'E'
)
&&
(
isdigit
(
z
[
i
+
1
])
||
((
z
[
i
+
1
]
==
'+'
||
z
[
i
+
1
]
==
'-'
)
&&
isdigit
(
z
[
i
+
2
]))))
{
i
+=
2
;
while
(
isdigit
(
z
[
i
]))
{
i
++
;
}
type
=
TK_FLOAT
;
}
goto
_end
;
}
default:
return
TK_ILLEGAL
;
}
}
_end:
return
(
i
<
pToken
->
n
)
?
TK_ILLEGAL
:
type
;
}
void
taosCleanupKeywordsTable
();
SStrToken
tscReplaceStrToken
(
char
**
str
,
SStrToken
*
token
,
const
char
*
newToken
);
SStrToken
taosTokenDup
(
SStrToken
*
pToken
,
char
*
buf
,
int32_t
len
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_COMMON_TOKEN_H_*/
include/common/tvariant.h
浏览文件 @
819c7fc0
...
...
@@ -13,52 +13,53 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_COMMON_VARIANT_H_
#define _TD_COMMON_VARIANT_H_
#include "tarray.h"
#include "ttoken.h"
#ifndef TDENGINE_TVARIANT_H
#define TDENGINE_TVARIANT_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include "tarray.h"
// variant, each number/string/field_id has a corresponding struct during parsing sql
typedef
struct
t
Variant
{
uint32_t
nType
;
int32_t
nLen
;
// only used for string, for number, it is useless
typedef
struct
S
Variant
{
uint32_t
nType
;
int32_t
nLen
;
// only used for string, for number, it is useless
union
{
int64_t
i64
;
uint64_t
u64
;
double
d
Key
;
char
*
pz
;
double
d
;
char
*
pz
;
wchar_t
*
wpz
;
SArray
*
arr
;
// only for 'in' query to hold value list, not value for a field
};
}
t
Variant
;
}
S
Variant
;
bool
t
VariantIsValid
(
t
Variant
*
pVar
);
bool
t
aosVariantIsValid
(
S
Variant
*
pVar
);
void
tVariantCreate
(
tVariant
*
pVar
,
SStr
Token
*
token
);
//void taosVariantCreate(SVariant *pVar, S
Token *token);
void
t
VariantCreateFromBinary
(
t
Variant
*
pVar
,
const
char
*
pz
,
size_t
len
,
uint32_t
type
);
void
t
aosVariantCreateFromBinary
(
S
Variant
*
pVar
,
const
char
*
pz
,
size_t
len
,
uint32_t
type
);
void
t
VariantDestroy
(
t
Variant
*
pV
);
void
t
aosVariantDestroy
(
S
Variant
*
pV
);
void
t
VariantAssign
(
tVariant
*
pDst
,
const
t
Variant
*
pSrc
);
void
t
aosVariantAssign
(
SVariant
*
pDst
,
const
S
Variant
*
pSrc
);
int32_t
t
VariantCompare
(
const
tVariant
*
p1
,
const
t
Variant
*
p2
);
int32_t
t
aosVariantCompare
(
const
SVariant
*
p1
,
const
S
Variant
*
p2
);
int32_t
t
VariantToString
(
t
Variant
*
pVar
,
char
*
dst
);
int32_t
t
aosVariantToString
(
S
Variant
*
pVar
,
char
*
dst
);
int32_t
t
VariantDump
(
t
Variant
*
pVariant
,
char
*
payload
,
int16_t
type
,
bool
includeLengthPrefix
);
int32_t
t
aosVariantDump
(
S
Variant
*
pVariant
,
char
*
payload
,
int16_t
type
,
bool
includeLengthPrefix
);
int32_t
tVariantDumpEx
(
tVariant
*
pVariant
,
char
*
payload
,
int16_t
type
,
bool
includeLengthPrefix
,
bool
*
converted
,
char
*
extInfo
);
#if 0
int32_t taosVariantDumpEx(SVariant *pVariant, char *payload, int16_t type, bool includeLengthPrefix, bool *converted, char *extInfo);
#endif
int32_t
t
VariantTypeSetType
(
t
Variant
*
pVariant
,
char
type
);
int32_t
t
aosVariantTypeSetType
(
S
Variant
*
pVariant
,
char
type
);
#ifdef __cplusplus
}
#endif
#endif
/
*_TD_COMMON_VARIANT_H_*/
#endif /
/ TDENGINE_TVARIANT_H
include/libs/catalog/catalog.h
浏览文件 @
819c7fc0
...
...
@@ -26,6 +26,7 @@ extern "C" {
#include "taosdef.h"
#include "transport.h"
#include "common.h"
#include "taosmsg.h"
struct
SCatalog
;
...
...
include/libs/parser/parser.h
浏览文件 @
819c7fc0
...
...
@@ -24,20 +24,20 @@ extern "C" {
#include "common.h"
#include "tname.h"
typedef
struct
SInterval
{
int32_t
tz
;
// query client timezone
char
intervalUnit
;
char
slidingUnit
;
char
offsetUnit
;
int64_t
interval
;
int64_t
sliding
;
int64_t
offset
;
}
SInterval
;
typedef
struct
SSessionWindow
{
int64_t
gap
;
// gap between two session window(in microseconds)
int32_t
primaryColId
;
// primary timestamp column
}
SSessionWindow
;
//
typedef struct SInterval {
//
int32_t tz; // query client timezone
//
char intervalUnit;
//
char slidingUnit;
//
char offsetUnit;
//
int64_t interval;
//
int64_t sliding;
//
int64_t offset;
//
} SInterval;
//
//
typedef struct SSessionWindow {
//
int64_t gap; // gap between two session window(in microseconds)
//
int32_t primaryColId; // primary timestamp column
//
} SSessionWindow;
typedef
struct
SGroupbyExpr
{
int16_t
tableIndex
;
...
...
include/libs/transport/transport.h
浏览文件 @
819c7fc0
...
...
@@ -20,23 +20,21 @@
extern
"C"
{
#endif
typedef
void
*
SEpSet
;
typedef
struct
SEpAddr
{
char
fqdn
[
TSDB_FQDN_LEN
];
uint16_t
port
;
}
SEpAddr
;
typedef
struct
SVgroup
{
int32_t
vgId
;
int8_t
numOfEps
;
SEpAddr
epAddr
[
TSDB_MAX_REPLICA
];
}
SVgroup
;
typedef
struct
SVgroupsInfo
{
int32_t
numOfVgroups
;
SVgroup
vgroups
[];
}
SVgroupsInfo
;
//typedef struct SEpAddr {
// char fqdn[TSDB_FQDN_LEN];
// uint16_t port;
//} SEpAddr;
//
//typedef struct SVgroup {
// int32_t vgId;
// int8_t numOfEps;
// SEpAddr epAddr[TSDB_MAX_REPLICA];
//} SVgroup;
//
//typedef struct SVgroupsInfo {
// int32_t numOfVgroups;
// SVgroup vgroups[];
//} SVgroupsInfo;
#ifdef __cplusplus
}
...
...
include/util/t
s
compression.h
→
include/util/tcompression.h
浏览文件 @
819c7fc0
文件已移动
include/util/tdef.h
浏览文件 @
819c7fc0
...
...
@@ -45,12 +45,7 @@ extern const int32_t TYPE_BYTES[15];
#define POINTER_BYTES sizeof(void *) // 8 by default assert(sizeof(ptrdiff_t) == sizseof(void*)
#define TSDB_KEYSIZE sizeof(TSKEY)
#if LINUX
#define TSDB_NCHAR_SIZE sizeof(wchar_t)
#else
#define TSDB_NCHAR_SIZE sizeof(int32_t)
#endif
// NULL definition
#define TSDB_DATA_BOOL_NULL 0x02
...
...
@@ -419,40 +414,40 @@ do { \
// ----------------- For variable data types such as TSDB_DATA_TYPE_BINARY and TSDB_DATA_TYPE_NCHAR
typedef
int32_t
VarDataOffsetT
;
typedef
int16_t
VarDataLenT
;
// maxVarDataLen: 32767
typedef
uint16_t
TDRowLenT
;
// not including overhead: 0 ~ 65535
typedef
uint32_t
TDRowTLenT
;
// total length, including overhead
typedef
struct
tstr
{
VarDataLenT
len
;
char
data
[];
}
tstr
;
#pragma pack(push, 1)
typedef
struct
{
VarDataLenT
len
;
uint8_t
data
;
}
SBinaryNullT
;
typedef
struct
{
VarDataLenT
len
;
uint32_t
data
;
}
SNCharNullT
;
#pragma pack(pop)
#define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
#define varDataLen(v) ((VarDataLenT *)(v))[0]
#define varDataTLen(v) (sizeof(VarDataLenT) + varDataLen(v))
#define varDataVal(v) ((void *)((char *)v + VARSTR_HEADER_SIZE))
#define varDataCopy(dst, v) memcpy((dst), (void*) (v), varDataTLen(v))
#define varDataLenByData(v) (*(VarDataLenT *)(((char*)(v)) - VARSTR_HEADER_SIZE))
#define varDataSetLen(v, _len) (((VarDataLenT *)(v))[0] = (VarDataLenT) (_len))
#define IS_VAR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_BINARY) || ((t) == TSDB_DATA_TYPE_NCHAR))
#define varDataNetLen(v) (htons(((VarDataLenT *)(v))[0]))
#define varDataNetTLen(v) (sizeof(VarDataLenT) + varDataNetLen(v))
//
typedef int32_t VarDataOffsetT;
//
typedef int16_t VarDataLenT; // maxVarDataLen: 32767
//
typedef uint16_t TDRowLenT; // not including overhead: 0 ~ 65535
//
typedef uint32_t TDRowTLenT; // total length, including overhead
//
//
typedef struct tstr {
//
VarDataLenT len;
//
char data[];
//
} tstr;
//
//
#pragma pack(push, 1)
//
typedef struct {
//
VarDataLenT len;
//
uint8_t data;
//
} SBinaryNullT;
//
//
typedef struct {
//
VarDataLenT len;
//
uint32_t data;
//
} SNCharNullT;
//
#pragma pack(pop)
//
//
#define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
//
//
#define varDataLen(v) ((VarDataLenT *)(v))[0]
//
#define varDataTLen(v) (sizeof(VarDataLenT) + varDataLen(v))
//
#define varDataVal(v) ((void *)((char *)v + VARSTR_HEADER_SIZE))
//
#define varDataCopy(dst, v) memcpy((dst), (void*) (v), varDataTLen(v))
//
#define varDataLenByData(v) (*(VarDataLenT *)(((char*)(v)) - VARSTR_HEADER_SIZE))
//
#define varDataSetLen(v, _len) (((VarDataLenT *)(v))[0] = (VarDataLenT) (_len))
//
#define IS_VAR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_BINARY) || ((t) == TSDB_DATA_TYPE_NCHAR))
//
//
#define varDataNetLen(v) (htons(((VarDataLenT *)(v))[0]))
//
#define varDataNetTLen(v) (sizeof(VarDataLenT) + varDataNetLen(v))
#ifdef __cplusplus
...
...
include/util/tutil.h
浏览文件 @
819c7fc0
...
...
@@ -40,8 +40,8 @@ char * paGetToken(char *src, char **token, int32_t *tokenLen);
int32_t
taosByteArrayToHexStr
(
char
bytes
[],
int32_t
len
,
char
hexstr
[]);
int32_t
taosHexStrToByteArray
(
char
hexstr
[],
char
bytes
[]);
bool
taosGetVersionNumber
(
char
*
versionStr
,
int
*
versionNubmer
);
int
taosCheckVersion
(
char
*
input_client_version
,
char
*
input_server_version
,
int
compared_segments
);
//
bool taosGetVersionNumber(char *versionStr, int *versionNubmer);
//
int taosCheckVersion(char *input_client_version, char *input_server_version, int compared_segments);
char
*
taosIpStr
(
uint32_t
ipInt
);
uint32_t
ip2uint
(
const
char
*
const
ip_addr
);
...
...
source/common/src/tarithoperator.c
已删除
100644 → 0
浏览文件 @
885380a1
此差异已折叠。
点击以展开。
source/
util
/src/tcompare.c
→
source/
common
/src/tcompare.c
浏览文件 @
819c7fc0
...
...
@@ -17,12 +17,12 @@
#define _XOPEN_SOURCE
#define _DEFAULT_SOURCE
#include "os.h"
#include "tcompare.h"
#include "ulog.h"
#include "thash.h"
#include "regex.h"
#include "os.h"
#include "tdef.h"
#include "ttypes.h"
int32_t
setCompareBytes1
(
const
void
*
pLeft
,
const
void
*
pRight
)
{
return
NULL
!=
taosHashGet
((
SHashObj
*
)
pRight
,
pLeft
,
1
)
?
1
:
0
;
...
...
source/common/src/tname.c
浏览文件 @
819c7fc0
...
...
@@ -2,22 +2,13 @@
#include "tutil.h"
#include "tname.h"
#include "ttoken.h"
#include "tvariant.h"
#include "taosmsg.h"
#define VALIDNUMOFCOLS(x) ((x) >= TSDB_MIN_COLUMNS && (x) <= TSDB_MAX_COLUMNS)
#define VALIDNUMOFTAGS(x) ((x) >= 0 && (x) <= TSDB_MAX_TAGS)
#define VALID_NAME_TYPE(x) ((x) == TSDB_DB_NAME_T || (x) == TSDB_TABLE_NAME_T)
//TODO remove it
void
extractTableName
(
const
char
*
tableId
,
char
*
name
)
{
size_t
s1
=
strcspn
(
tableId
,
&
TS_PATH_DELIMITER
[
0
]);
size_t
s2
=
strcspn
(
&
tableId
[
s1
+
1
],
&
TS_PATH_DELIMITER
[
0
]);
tstrncpy
(
name
,
&
tableId
[
s1
+
s2
+
2
],
TSDB_TABLE_NAME_LEN
);
}
char
*
extractDBName
(
const
char
*
tableId
,
char
*
name
)
{
size_t
offset1
=
strcspn
(
tableId
,
&
TS_PATH_DELIMITER
[
0
]);
size_t
len
=
strcspn
(
&
tableId
[
offset1
+
1
],
&
TS_PATH_DELIMITER
[
0
]);
...
...
@@ -33,28 +24,6 @@ size_t tableIdPrefix(const char* name, char* prefix, int32_t len) {
return
strlen
(
prefix
);
}
SSchema
tGetUserSpecifiedColumnSchema
(
tVariant
*
pVal
,
SStrToken
*
exprStr
,
const
char
*
name
)
{
SSchema
s
=
{
0
};
s
.
type
=
pVal
->
nType
;
if
(
s
.
type
==
TSDB_DATA_TYPE_BINARY
||
s
.
type
==
TSDB_DATA_TYPE_NCHAR
)
{
s
.
bytes
=
(
int16_t
)(
pVal
->
nLen
+
VARSTR_HEADER_SIZE
);
}
else
{
s
.
bytes
=
tDataTypes
[
pVal
->
nType
].
bytes
;
}
s
.
colId
=
TSDB_UD_COLUMN_INDEX
;
if
(
name
!=
NULL
)
{
tstrncpy
(
s
.
name
,
name
,
sizeof
(
s
.
name
));
}
else
{
size_t
tlen
=
MIN
(
sizeof
(
s
.
name
),
exprStr
->
n
+
1
);
tstrncpy
(
s
.
name
,
exprStr
->
z
,
tlen
);
strdequote
(
s
.
name
);
}
return
s
;
}
bool
tscValidateTableNameLength
(
size_t
len
)
{
return
len
<
TSDB_TABLE_NAME_LEN
;
}
...
...
@@ -155,30 +124,30 @@ int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t slidingTime, in
* tablePrefix.columnName
* extract table name and save it in pTable, with only column name in pToken
*/
void
extractTableNameFromToken
(
SStrToken
*
pToken
,
SStrToken
*
pTable
)
{
const
char
sep
=
TS_PATH_DELIMITER
[
0
];
if
(
pToken
==
pTable
||
pToken
==
NULL
||
pTable
==
NULL
)
{
return
;
}
char
*
r
=
strnchr
(
pToken
->
z
,
sep
,
pToken
->
n
,
false
);
if
(
r
!=
NULL
)
{
// record the table name token
pTable
->
n
=
(
uint32_t
)(
r
-
pToken
->
z
);
pTable
->
z
=
pToken
->
z
;
r
+=
1
;
pToken
->
n
-=
(
uint32_t
)(
r
-
pToken
->
z
);
pToken
->
z
=
r
;
}
}
//
void extractTableNameFromToken(SStrToken* pToken, SStrToken* pTable) {
//
const char sep = TS_PATH_DELIMITER[0];
//
//
if (pToken == pTable || pToken == NULL || pTable == NULL) {
//
return;
//
}
//
//
char* r = strnchr(pToken->z, sep, pToken->n, false);
//
//
if (r != NULL) { // record the table name token
//
pTable->n = (uint32_t)(r - pToken->z);
//
pTable->z = pToken->z;
//
//
r += 1;
//
pToken->n -= (uint32_t)(r - pToken->z);
//
pToken->z = r;
//
}
//
}
static
struct
SSchema
_s
=
{
.
colId
=
TSDB_TBNAME_COLUMN_INDEX
,
.
type
=
TSDB_DATA_TYPE_BINARY
,
.
bytes
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
,
.
name
=
TSQL_TBNAME_L
,
.
name
=
"tbname"
,
};
SSchema
*
tGetTbnameColumnSchema
()
{
...
...
@@ -337,19 +306,19 @@ void tNameAssign(SName* dst, const SName* src) {
memcpy
(
dst
,
src
,
sizeof
(
SName
));
}
int32_t
tNameSetDbName
(
SName
*
dst
,
const
char
*
acct
,
SStrToken
*
dbToken
)
{
assert
(
dst
!=
NULL
&&
dbToken
!=
NULL
&&
acct
!=
NULL
);
// too long account id or too long db name
if
(
strlen
(
acct
)
>=
tListLen
(
dst
->
acctId
)
||
dbToken
->
n
>=
tListLen
(
dst
->
dbname
))
{
return
-
1
;
}
dst
->
type
=
TSDB_DB_NAME_T
;
tstrncpy
(
dst
->
acctId
,
acct
,
tListLen
(
dst
->
acctId
));
tstrncpy
(
dst
->
dbname
,
dbToken
->
z
,
dbToken
->
n
+
1
);
return
0
;
}
//
int32_t tNameSetDbName(SName* dst, const char* acct, SStrToken* dbToken) {
//
assert(dst != NULL && dbToken != NULL && acct != NULL);
//
//
// too long account id or too long db name
//
if (strlen(acct) >= tListLen(dst->acctId) || dbToken->n >= tListLen(dst->dbname)) {
//
return -1;
//
}
//
//
dst->type = TSDB_DB_NAME_T;
//
tstrncpy(dst->acctId, acct, tListLen(dst->acctId));
//
tstrncpy(dst->dbname, dbToken->z, dbToken->n + 1);
//
return 0;
//
}
int32_t
tNameSetAcctId
(
SName
*
dst
,
const
char
*
acct
)
{
assert
(
dst
!=
NULL
&&
acct
!=
NULL
);
...
...
source/common/src/ttypes.c
浏览文件 @
819c7fc0
...
...
@@ -13,9 +13,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "taos.h"
#include "os.h"
#include "ttypes.h"
#include "../../../include/client/taos.h"
#include "os.h"
#include "tcompression.h"
const
int32_t
TYPE_BYTES
[
15
]
=
{
...
...
source/common/src/tvariant.c
浏览文件 @
819c7fc0
...
...
@@ -14,13 +14,12 @@
*/
#include "os.h"
#include "hash.h"
#include "taos.h"
#include "thash.h"
#include "taosdef.h"
#include "ttime.h"
#include "ttoken.h"
#include "ttokendef.h"
#include "ttype.h"
#include "ttype
s
.h"
#include "tutil.h"
#include "tvariant.h"
...
...
@@ -30,12 +29,12 @@
if ((res) > (maxv)) { *exti = 1; break; } \
assert(0); \
} while (0)
void
tVariantCreate
(
tVariant
*
pVar
,
SStr
Token
*
token
)
{
#if 0
void tVariantCreate(
SVariant *pVar, S
Token *token) {
int32_t ret = 0;
int32_t type = token->type;
memset
(
pVar
,
0
,
sizeof
(
t
Variant
));
memset(pVar, 0, sizeof(
S
Variant));
switch (token->type) {
case TSDB_DATA_TYPE_BOOL: {
...
...
@@ -56,7 +55,7 @@ void tVariantCreate(tVariant *pVar, SStrToken *token) {
case TSDB_DATA_TYPE_INT:{
ret = tStrToInteger(token->z, token->type, token->n, &pVar->i64, true);
if (ret != 0) {
S
Str
Token
t
=
{
0
};
SToken t = {0};
tGetToken(token->z, &t.type);
if (t.type == TK_MINUS) { // it is a signed number which is greater than INT64_MAX or less than INT64_MIN
pVar->nType = -1; // -1 means error type
...
...
@@ -76,7 +75,7 @@ void tVariantCreate(tVariant *pVar, SStrToken *token) {
case TSDB_DATA_TYPE_DOUBLE:
case TSDB_DATA_TYPE_FLOAT: {
pVar
->
d
Key
=
strtod
(
token
->
z
,
NULL
);
pVar->d = strtod(token->z, NULL);
break;
}
...
...
@@ -97,15 +96,16 @@ void tVariantCreate(tVariant *pVar, SStrToken *token) {
pVar->nType = type;
}
#endif
/**
* create
t
Variant from binary string, not ascii data
* create
S
Variant from binary string, not ascii data
* @param pVar
* @param pz
* @param len
* @param type
*/
void
tVariantCreateFromBinary
(
t
Variant
*
pVar
,
const
char
*
pz
,
size_t
len
,
uint32_t
type
)
{
void
tVariantCreateFromBinary
(
S
Variant
*
pVar
,
const
char
*
pz
,
size_t
len
,
uint32_t
type
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_TINYINT
:
{
...
...
@@ -151,12 +151,12 @@ void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32
}
case
TSDB_DATA_TYPE_DOUBLE
:
{
pVar
->
nLen
=
tDataTypes
[
type
].
bytes
;
pVar
->
d
Key
=
GET_DOUBLE_VAL
(
pz
);
pVar
->
d
=
GET_DOUBLE_VAL
(
pz
);
break
;
}
case
TSDB_DATA_TYPE_FLOAT
:
{
pVar
->
nLen
=
tDataTypes
[
type
].
bytes
;
pVar
->
d
Key
=
GET_FLOAT_VAL
(
pz
);
pVar
->
d
=
GET_FLOAT_VAL
(
pz
);
break
;
}
case
TSDB_DATA_TYPE_NCHAR
:
{
// here we get the nchar length from raw binary bits length
...
...
@@ -183,7 +183,7 @@ void tVariantCreateFromBinary(tVariant *pVar, const char *pz, size_t len, uint32
pVar
->
nType
=
type
;
}
void
tVariantDestroy
(
t
Variant
*
pVar
)
{
void
tVariantDestroy
(
S
Variant
*
pVar
)
{
if
(
pVar
==
NULL
)
return
;
if
(
pVar
->
nType
==
TSDB_DATA_TYPE_BINARY
||
pVar
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
...
...
@@ -206,12 +206,12 @@ void tVariantDestroy(tVariant *pVar) {
}
}
bool
tVariantIsValid
(
t
Variant
*
pVar
)
{
bool
tVariantIsValid
(
S
Variant
*
pVar
)
{
assert
(
pVar
!=
NULL
);
return
isValidDataType
(
pVar
->
nType
);
}
void
tVariantAssign
(
tVariant
*
pDst
,
const
t
Variant
*
pSrc
)
{
void
tVariantAssign
(
SVariant
*
pDst
,
const
S
Variant
*
pSrc
)
{
if
(
pSrc
==
NULL
||
pDst
==
NULL
)
return
;
pDst
->
nType
=
pSrc
->
nType
;
...
...
@@ -255,7 +255,7 @@ void tVariantAssign(tVariant *pDst, const tVariant *pSrc) {
}
}
int32_t
tVariantCompare
(
const
tVariant
*
p1
,
const
t
Variant
*
p2
)
{
int32_t
tVariantCompare
(
const
SVariant
*
p1
,
const
S
Variant
*
p2
)
{
if
(
p1
->
nType
==
TSDB_DATA_TYPE_NULL
&&
p2
->
nType
==
TSDB_DATA_TYPE_NULL
)
{
return
0
;
}
...
...
@@ -275,10 +275,10 @@ int32_t tVariantCompare(const tVariant* p1, const tVariant* p2) {
return
p1
->
nLen
>
p2
->
nLen
?
1
:-
1
;
}
}
else
if
(
p1
->
nType
==
TSDB_DATA_TYPE_FLOAT
||
p1
->
nType
==
TSDB_DATA_TYPE_DOUBLE
)
{
if
(
p1
->
d
Key
==
p2
->
dKey
)
{
if
(
p1
->
d
==
p2
->
d
)
{
return
0
;
}
else
{
return
p1
->
d
Key
>
p2
->
dKey
?
1
:-
1
;
return
p1
->
d
>
p2
->
d
?
1
:-
1
;
}
}
else
if
(
IS_UNSIGNED_NUMERIC_TYPE
(
p1
->
nType
))
{
if
(
p1
->
u64
==
p2
->
u64
)
{
...
...
@@ -295,7 +295,7 @@ int32_t tVariantCompare(const tVariant* p1, const tVariant* p2) {
}
}
int32_t
tVariantToString
(
t
Variant
*
pVar
,
char
*
dst
)
{
int32_t
tVariantToString
(
S
Variant
*
pVar
,
char
*
dst
)
{
if
(
pVar
==
NULL
||
dst
==
NULL
)
return
0
;
switch
(
pVar
->
nType
)
{
...
...
@@ -329,7 +329,7 @@ int32_t tVariantToString(tVariant *pVar, char *dst) {
return
sprintf
(
dst
,
"%"
PRIu64
,
pVar
->
u64
);
case
TSDB_DATA_TYPE_FLOAT
:
case
TSDB_DATA_TYPE_DOUBLE
:
return
sprintf
(
dst
,
"%.9lf"
,
pVar
->
d
Key
);
return
sprintf
(
dst
,
"%.9lf"
,
pVar
->
d
);
default:
return
0
;
...
...
@@ -360,11 +360,11 @@ static FORCE_INLINE int32_t wcsconvertToBoolImpl(wchar_t *pstr, int32_t len) {
}
}
static
int32_t
toBinary
(
t
Variant
*
pVariant
,
char
**
pDest
,
int32_t
*
pDestSize
)
{
static
int32_t
toBinary
(
S
Variant
*
pVariant
,
char
**
pDest
,
int32_t
*
pDestSize
)
{
const
int32_t
INITIAL_ALLOC_SIZE
=
40
;
char
*
pBuf
=
NULL
;
// it is a in-place convert type for
t
Variant, local buffer is needed
// it is a in-place convert type for
S
Variant, local buffer is needed
if
(
*
pDest
==
pVariant
->
pz
)
{
pBuf
=
calloc
(
1
,
INITIAL_ALLOC_SIZE
);
}
...
...
@@ -387,7 +387,7 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
if
(
IS_SIGNED_NUMERIC_TYPE
(
pVariant
->
nType
))
{
sprintf
(
pBuf
==
NULL
?
*
pDest
:
pBuf
,
"%"
PRId64
,
pVariant
->
i64
);
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_DOUBLE
||
pVariant
->
nType
==
TSDB_DATA_TYPE_FLOAT
)
{
sprintf
(
pBuf
==
NULL
?
*
pDest
:
pBuf
,
"%lf"
,
pVariant
->
d
Key
);
sprintf
(
pBuf
==
NULL
?
*
pDest
:
pBuf
,
"%lf"
,
pVariant
->
d
);
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_BOOL
)
{
sprintf
(
pBuf
==
NULL
?
*
pDest
:
pBuf
,
"%s"
,
(
pVariant
->
i64
==
TSDB_TRUE
)
?
"TRUE"
:
"FALSE"
);
}
else
if
(
pVariant
->
nType
==
0
)
{
// null data
...
...
@@ -403,7 +403,7 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
return
0
;
}
static
int32_t
toNchar
(
t
Variant
*
pVariant
,
char
**
pDest
,
int32_t
*
pDestSize
)
{
static
int32_t
toNchar
(
S
Variant
*
pVariant
,
char
**
pDest
,
int32_t
*
pDestSize
)
{
char
tmpBuf
[
40
]
=
{
0
};
char
*
pDst
=
tmpBuf
;
...
...
@@ -415,7 +415,7 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
}
else
if
(
IS_UNSIGNED_NUMERIC_TYPE
(
pVariant
->
nType
))
{
nLen
=
sprintf
(
pDst
,
"%"
PRIu64
,
pVariant
->
u64
);
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_DOUBLE
||
pVariant
->
nType
==
TSDB_DATA_TYPE_FLOAT
)
{
nLen
=
sprintf
(
pDst
,
"%lf"
,
pVariant
->
d
Key
);
nLen
=
sprintf
(
pDst
,
"%lf"
,
pVariant
->
d
);
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_BINARY
)
{
pDst
=
pVariant
->
pz
;
nLen
=
pVariant
->
nLen
;
...
...
@@ -461,30 +461,30 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
}
static
FORCE_INLINE
int32_t
convertToDouble
(
char
*
pStr
,
int32_t
len
,
double
*
value
)
{
SStr
Token
stoken
=
{.
z
=
pStr
,
.
n
=
len
};
if
(
TK_ILLEGAL
==
tGetNumericStringType
(
&
stoken
))
{
return
-
1
;
}
*
value
=
strtod
(
pStr
,
NULL
);
// S
Token stoken = {.z = pStr, .n = len};
//
if (TK_ILLEGAL == tGetNumericStringType(&stoken)) {
//
return -1;
//
}
//
//
*value = strtod(pStr, NULL);
return
0
;
}
static
FORCE_INLINE
int32_t
convertToInteger
(
t
Variant
*
pVariant
,
int64_t
*
result
,
int32_t
type
,
bool
issigned
,
bool
releaseVariantPtr
,
bool
*
converted
)
{
static
FORCE_INLINE
int32_t
convertToInteger
(
S
Variant
*
pVariant
,
int64_t
*
result
,
int32_t
type
,
bool
issigned
,
bool
releaseVariantPtr
,
bool
*
converted
)
{
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_NULL
)
{
setNull
((
char
*
)
result
,
type
,
tDataTypes
[
type
].
bytes
);
return
0
;
}
#if 0
errno = 0;
if (IS_SIGNED_NUMERIC_TYPE(pVariant->nType) || (pVariant->nType == TSDB_DATA_TYPE_BOOL)) {
*result = pVariant->i64;
} else if (IS_UNSIGNED_NUMERIC_TYPE(pVariant->nType)) {
*result = pVariant->u64;
} else if (IS_FLOAT_TYPE(pVariant->nType)) {
*
result
=
(
int64_t
)
pVariant
->
d
Key
;
*result = (int64_t) pVariant->d;
} else if (pVariant->nType == TSDB_DATA_TYPE_BINARY) {
S
Str
Token
token
=
{.
z
=
pVariant
->
pz
,
.
n
=
pVariant
->
nLen
};
SToken token = {.z = pVariant->pz, .n = pVariant->nLen};
/*int32_t n = */tGetToken(pVariant->pz, &token.type);
if (token.type == TK_NULL) {
...
...
@@ -519,7 +519,7 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
errno = 0;
wchar_t *endPtr = NULL;
S
Str
Token
token
=
{
0
};
SToken token = {0};
token.n = tGetToken(pVariant->pz, &token.type);
if (token.type == TK_MINUS || token.type == TK_PLUS) {
...
...
@@ -590,16 +590,19 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
code = IS_VALID_UBIGINT(ui); break;
}
return code? 0:-1;
#endif
return
0
;
}
static
int32_t
convertToBool
(
t
Variant
*
pVariant
,
int64_t
*
pDest
)
{
static
int32_t
convertToBool
(
S
Variant
*
pVariant
,
int64_t
*
pDest
)
{
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_BOOL
)
{
*
pDest
=
pVariant
->
i64
;
// in order to be compatible to null of bool
}
else
if
(
IS_NUMERIC_TYPE
(
pVariant
->
nType
))
{
*
pDest
=
((
pVariant
->
i64
!=
0
)
?
TSDB_TRUE
:
TSDB_FALSE
);
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_FLOAT
||
pVariant
->
nType
==
TSDB_DATA_TYPE_DOUBLE
)
{
*
pDest
=
((
pVariant
->
d
Key
!=
0
)
?
TSDB_TRUE
:
TSDB_FALSE
);
*
pDest
=
((
pVariant
->
d
!=
0
)
?
TSDB_TRUE
:
TSDB_FALSE
);
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_BINARY
)
{
int32_t
ret
=
0
;
if
((
ret
=
convertToBoolImpl
(
pVariant
->
pz
,
pVariant
->
nLen
))
<
0
)
{
...
...
@@ -625,15 +628,7 @@ static int32_t convertToBool(tVariant *pVariant, int64_t *pDest) {
* transfer data from variant serve as the implicit data conversion: from input sql string pVariant->nType
* to column type defined in schema
*/
int32_t
tVariantDump
(
tVariant
*
pVariant
,
char
*
payload
,
int16_t
type
,
bool
includeLengthPrefix
)
{
return
tVariantDumpEx
(
pVariant
,
payload
,
type
,
includeLengthPrefix
,
NULL
,
NULL
);
}
/*
* transfer data from variant serve as the implicit data conversion: from input sql string pVariant->nType
* to column type defined in schema
*/
int32_t
tVariantDumpEx
(
tVariant
*
pVariant
,
char
*
payload
,
int16_t
type
,
bool
includeLengthPrefix
,
bool
*
converted
,
char
*
extInfo
)
{
int32_t
tVariantDumpEx
(
SVariant
*
pVariant
,
char
*
payload
,
int16_t
type
,
bool
includeLengthPrefix
,
bool
*
converted
,
char
*
extInfo
)
{
if
(
converted
)
{
*
converted
=
false
;
}
...
...
@@ -766,12 +761,12 @@ int32_t tVariantDumpEx(tVariant *pVariant, char *payload, int16_t type, bool inc
*
converted
=
true
;
}
if
(
pVariant
->
d
Key
>
FLT_MAX
||
pVariant
->
dKey
<
-
FLT_MAX
)
{
SET_EXT_INFO
(
converted
,
pVariant
->
d
Key
,
-
FLT_MAX
,
FLT_MAX
,
extInfo
);
if
(
pVariant
->
d
>
FLT_MAX
||
pVariant
->
d
<
-
FLT_MAX
)
{
SET_EXT_INFO
(
converted
,
pVariant
->
d
,
-
FLT_MAX
,
FLT_MAX
,
extInfo
);
return
-
1
;
}
SET_FLOAT_VAL
(
payload
,
pVariant
->
d
Key
);
SET_FLOAT_VAL
(
payload
,
pVariant
->
d
);
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_NULL
)
{
*
((
uint32_t
*
)
payload
)
=
TSDB_DATA_FLOAT_NULL
;
return
0
;
...
...
@@ -802,7 +797,7 @@ int32_t tVariantDumpEx(tVariant *pVariant, char *payload, int16_t type, bool inc
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_BOOL
||
IS_SIGNED_NUMERIC_TYPE
(
pVariant
->
nType
)
||
IS_UNSIGNED_NUMERIC_TYPE
(
pVariant
->
nType
))
{
SET_DOUBLE_VAL
(
payload
,
pVariant
->
i64
);
}
else
if
(
IS_FLOAT_TYPE
(
pVariant
->
nType
))
{
SET_DOUBLE_VAL
(
payload
,
pVariant
->
d
Key
);
SET_DOUBLE_VAL
(
payload
,
pVariant
->
d
);
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_NULL
)
{
*
((
int64_t
*
)
payload
)
=
TSDB_DATA_DOUBLE_NULL
;
return
0
;
...
...
@@ -894,6 +889,13 @@ int32_t tVariantDumpEx(tVariant *pVariant, char *payload, int16_t type, bool inc
return
0
;
}
/*
* transfer data from variant serve as the implicit data conversion: from input sql string pVariant->nType
* to column type defined in schema
*/
int32_t
tVariantDump
(
SVariant
*
pVariant
,
char
*
payload
,
int16_t
type
,
bool
includeLengthPrefix
)
{
return
tVariantDumpEx
(
pVariant
,
payload
,
type
,
includeLengthPrefix
,
NULL
,
NULL
);
}
/*
* In variant, bool/smallint/tinyint/int/bigint share the same attribution of
...
...
@@ -901,7 +903,7 @@ int32_t tVariantDumpEx(tVariant *pVariant, char *payload, int16_t type, bool inc
*
* It is actually the bigint/binary/bool/nchar type transfer
*/
int32_t
tVariantTypeSetType
(
t
Variant
*
pVariant
,
char
type
)
{
int32_t
tVariantTypeSetType
(
S
Variant
*
pVariant
,
char
type
)
{
if
(
pVariant
==
NULL
||
pVariant
->
nType
==
0
)
{
// value is not set
return
0
;
}
...
...
@@ -934,7 +936,7 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type) {
}
free
(
pVariant
->
pz
);
pVariant
->
d
Key
=
v
;
pVariant
->
d
=
v
;
}
else
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_NCHAR
)
{
errno
=
0
;
double
v
=
wcstod
(
pVariant
->
wpz
,
NULL
);
...
...
@@ -944,10 +946,10 @@ int32_t tVariantTypeSetType(tVariant *pVariant, char type) {
}
free
(
pVariant
->
pz
);
pVariant
->
d
Key
=
v
;
pVariant
->
d
=
v
;
}
else
if
(
pVariant
->
nType
>=
TSDB_DATA_TYPE_BOOL
&&
pVariant
->
nType
<=
TSDB_DATA_TYPE_BIGINT
)
{
double
tmp
=
(
double
)
pVariant
->
i64
;
pVariant
->
d
Key
=
tmp
;
pVariant
->
d
=
tmp
;
}
pVariant
->
nType
=
TSDB_DATA_TYPE_DOUBLE
;
...
...
source/libs/executor/CMakeLists.txt
浏览文件 @
819c7fc0
...
...
@@ -4,4 +4,9 @@ target_include_directories(
executor
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/libs/executor"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
target_link_libraries
(
executor
PRIVATE os util common
)
\ No newline at end of file
source/libs/executor/src/tarithoperator.h
已删除
100644 → 0
浏览文件 @
885380a1
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_COMMON_QARITHMETICOPERATOR_H_
#define _TD_COMMON_QARITHMETICOPERATOR_H_
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
void
(
*
_arithmetic_operator_fn_t
)(
void
*
left
,
int32_t
numLeft
,
int32_t
leftType
,
void
*
right
,
int32_t
numRight
,
int32_t
rightType
,
void
*
output
,
int32_t
order
);
_arithmetic_operator_fn_t
getArithmeticOperatorFn
(
int32_t
arithmeticOptr
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_COMMON_QARITHMETICOPERATOR_H_*/
source/
common
/src/texpr.c
→
source/
libs/executor
/src/texpr.c
浏览文件 @
819c7fc0
...
...
@@ -13,7 +13,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <texpr.h>
#include "os.h"
#include "texpr.h"
...
...
@@ -24,11 +23,11 @@
#include "tbuffer.h"
#include "tcompare.h"
#include "tname.h"
#include "hash.h"
// #include "tsdb.h"
#include "thash.h"
#include "tskiplist.h"
#include "texpr.h"
#include "tarithoperator.h"
#include "tvariant.h"
static
uint8_t
UNUSED_FUNC
isQueryOnPrimaryKey
(
const
char
*
primaryColumnName
,
const
tExprNode
*
pLeft
,
const
tExprNode
*
pRight
)
{
if
(
pLeft
->
nodeType
==
TSQL_NODE_COL
)
{
...
...
@@ -287,7 +286,7 @@ static void exprTreeToBinaryImpl(SBufferWriter* bw, tExprNode* expr) {
tbufWriteUint8
(
bw
,
expr
->
nodeType
);
if
(
expr
->
nodeType
==
TSQL_NODE_VALUE
)
{
t
Variant
*
pVal
=
expr
->
pVal
;
S
Variant
*
pVal
=
expr
->
pVal
;
tbufWriteUint32
(
bw
,
pVal
->
nType
);
if
(
pVal
->
nType
==
TSDB_DATA_TYPE_BINARY
)
{
...
...
@@ -355,7 +354,7 @@ static tExprNode* exprTreeFromBinaryImpl(SBufferReader* br) {
pExpr
->
nodeType
=
tbufReadUint8
(
br
);
if
(
pExpr
->
nodeType
==
TSQL_NODE_VALUE
)
{
tVariant
*
pVal
=
exception_calloc
(
1
,
sizeof
(
t
Variant
));
SVariant
*
pVal
=
exception_calloc
(
1
,
sizeof
(
S
Variant
));
pExpr
->
pVal
=
pVal
;
pVal
->
nType
=
tbufReadUint32
(
br
);
...
...
@@ -416,7 +415,7 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) {
SSchema
*
pSchema
=
exception_calloc
(
1
,
sizeof
(
SSchema
));
left
->
pSchema
=
pSchema
;
*
pSchema
=
*
tGetTbnameColumnSchema
();
// *pSchema = NULL;//
*tGetTbnameColumnSchema();
tExprNode
*
right
=
exception_calloc
(
1
,
sizeof
(
tExprNode
));
expr
->
_node
.
pRight
=
right
;
...
...
@@ -424,7 +423,7 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) {
if
(
strncmp
(
tbnameCond
,
QUERY_COND_REL_PREFIX_LIKE
,
QUERY_COND_REL_PREFIX_LIKE_LEN
)
==
0
)
{
right
->
nodeType
=
TSQL_NODE_VALUE
;
expr
->
_node
.
optr
=
TSDB_RELATION_LIKE
;
tVariant
*
pVal
=
exception_calloc
(
1
,
sizeof
(
t
Variant
));
SVariant
*
pVal
=
exception_calloc
(
1
,
sizeof
(
S
Variant
));
right
->
pVal
=
pVal
;
size_t
len
=
strlen
(
tbnameCond
+
QUERY_COND_REL_PREFIX_LIKE_LEN
)
+
1
;
pVal
->
pz
=
exception_malloc
(
len
);
...
...
@@ -435,7 +434,7 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) {
}
else
if
(
strncmp
(
tbnameCond
,
QUERY_COND_REL_PREFIX_MATCH
,
QUERY_COND_REL_PREFIX_MATCH_LEN
)
==
0
)
{
right
->
nodeType
=
TSQL_NODE_VALUE
;
expr
->
_node
.
optr
=
TSDB_RELATION_MATCH
;
tVariant
*
pVal
=
exception_calloc
(
1
,
sizeof
(
t
Variant
));
SVariant
*
pVal
=
exception_calloc
(
1
,
sizeof
(
S
Variant
));
right
->
pVal
=
pVal
;
size_t
len
=
strlen
(
tbnameCond
+
QUERY_COND_REL_PREFIX_MATCH_LEN
)
+
1
;
pVal
->
pz
=
exception_malloc
(
len
);
...
...
@@ -445,7 +444,7 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) {
}
else
if
(
strncmp
(
tbnameCond
,
QUERY_COND_REL_PREFIX_NMATCH
,
QUERY_COND_REL_PREFIX_NMATCH_LEN
)
==
0
)
{
right
->
nodeType
=
TSQL_NODE_VALUE
;
expr
->
_node
.
optr
=
TSDB_RELATION_NMATCH
;
tVariant
*
pVal
=
exception_calloc
(
1
,
sizeof
(
t
Variant
));
SVariant
*
pVal
=
exception_calloc
(
1
,
sizeof
(
S
Variant
));
right
->
pVal
=
pVal
;
size_t
len
=
strlen
(
tbnameCond
+
QUERY_COND_REL_PREFIX_NMATCH_LEN
)
+
1
;
pVal
->
pz
=
exception_malloc
(
len
);
...
...
@@ -455,7 +454,7 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) {
}
else
if
(
strncmp
(
tbnameCond
,
QUERY_COND_REL_PREFIX_IN
,
QUERY_COND_REL_PREFIX_IN_LEN
)
==
0
)
{
right
->
nodeType
=
TSQL_NODE_VALUE
;
expr
->
_node
.
optr
=
TSDB_RELATION_IN
;
tVariant
*
pVal
=
exception_calloc
(
1
,
sizeof
(
t
Variant
));
SVariant
*
pVal
=
exception_calloc
(
1
,
sizeof
(
S
Variant
));
right
->
pVal
=
pVal
;
pVal
->
nType
=
TSDB_DATA_TYPE_POINTER_ARRAY
;
pVal
->
arr
=
taosArrayInit
(
2
,
POINTER_BYTES
);
...
...
@@ -532,7 +531,7 @@ void convertFilterSetFromBinary(void **q, const char *buf, int32_t len, uint32_t
taosHashSetEqualFp
(
pObj
,
taosGetDefaultEqualFunction
(
tType
));
int
dummy
=
-
1
;
t
Variant
tmpVar
=
{
0
};
S
Variant
tmpVar
=
{
0
};
size_t
t
=
0
;
int32_t
sz
=
tbufReadInt32
(
&
br
);
void
*
pvar
=
NULL
;
...
...
@@ -615,7 +614,7 @@ void convertFilterSetFromBinary(void **q, const char *buf, int32_t len, uint32_t
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_UTINYINT
:
case
TSDB_DATA_TYPE_TINYINT
:
{
if
(
tVariantDump
(
&
tmpVar
,
(
char
*
)
&
val
,
tType
,
false
))
{
if
(
t
aos
VariantDump
(
&
tmpVar
,
(
char
*
)
&
val
,
tType
,
false
))
{
goto
err_ret
;
}
pvar
=
&
val
;
...
...
@@ -624,7 +623,7 @@ void convertFilterSetFromBinary(void **q, const char *buf, int32_t len, uint32_t
}
case
TSDB_DATA_TYPE_USMALLINT
:
case
TSDB_DATA_TYPE_SMALLINT
:
{
if
(
tVariantDump
(
&
tmpVar
,
(
char
*
)
&
val
,
tType
,
false
))
{
if
(
t
aos
VariantDump
(
&
tmpVar
,
(
char
*
)
&
val
,
tType
,
false
))
{
goto
err_ret
;
}
pvar
=
&
val
;
...
...
@@ -633,7 +632,7 @@ void convertFilterSetFromBinary(void **q, const char *buf, int32_t len, uint32_t
}
case
TSDB_DATA_TYPE_UINT
:
case
TSDB_DATA_TYPE_INT
:
{
if
(
tVariantDump
(
&
tmpVar
,
(
char
*
)
&
val
,
tType
,
false
))
{
if
(
t
aos
VariantDump
(
&
tmpVar
,
(
char
*
)
&
val
,
tType
,
false
))
{
goto
err_ret
;
}
pvar
=
&
val
;
...
...
@@ -643,7 +642,7 @@ void convertFilterSetFromBinary(void **q, const char *buf, int32_t len, uint32_t
case
TSDB_DATA_TYPE_TIMESTAMP
:
case
TSDB_DATA_TYPE_UBIGINT
:
case
TSDB_DATA_TYPE_BIGINT
:
{
if
(
tVariantDump
(
&
tmpVar
,
(
char
*
)
&
val
,
tType
,
false
))
{
if
(
t
aos
VariantDump
(
&
tmpVar
,
(
char
*
)
&
val
,
tType
,
false
))
{
goto
err_ret
;
}
pvar
=
&
val
;
...
...
@@ -651,7 +650,7 @@ void convertFilterSetFromBinary(void **q, const char *buf, int32_t len, uint32_t
break
;
}
case
TSDB_DATA_TYPE_DOUBLE
:
{
if
(
tVariantDump
(
&
tmpVar
,
(
char
*
)
&
val
,
tType
,
false
))
{
if
(
t
aos
VariantDump
(
&
tmpVar
,
(
char
*
)
&
val
,
tType
,
false
))
{
goto
err_ret
;
}
pvar
=
&
val
;
...
...
@@ -659,7 +658,7 @@ void convertFilterSetFromBinary(void **q, const char *buf, int32_t len, uint32_t
break
;
}
case
TSDB_DATA_TYPE_FLOAT
:
{
if
(
tVariantDump
(
&
tmpVar
,
(
char
*
)
&
val
,
tType
,
false
))
{
if
(
t
aos
VariantDump
(
&
tmpVar
,
(
char
*
)
&
val
,
tType
,
false
))
{
goto
err_ret
;
}
pvar
=
&
val
;
...
...
@@ -667,7 +666,7 @@ void convertFilterSetFromBinary(void **q, const char *buf, int32_t len, uint32_t
break
;
}
case
TSDB_DATA_TYPE_BINARY
:
{
if
(
tVariantDump
(
&
tmpVar
,
tmp
,
tType
,
true
))
{
if
(
t
aos
VariantDump
(
&
tmpVar
,
tmp
,
tType
,
true
))
{
goto
err_ret
;
}
t
=
varDataLen
(
tmp
);
...
...
@@ -675,7 +674,7 @@ void convertFilterSetFromBinary(void **q, const char *buf, int32_t len, uint32_t
break
;
}
case
TSDB_DATA_TYPE_NCHAR
:
{
if
(
tVariantDump
(
&
tmpVar
,
tmp
,
tType
,
true
))
{
if
(
t
aos
VariantDump
(
&
tmpVar
,
tmp
,
tType
,
true
))
{
goto
err_ret
;
}
t
=
varDataLen
(
tmp
);
...
...
@@ -716,7 +715,7 @@ tExprNode* exprdup(tExprNode* pNode) {
pCloned
->
_node
.
optr
=
pNode
->
_node
.
optr
;
pCloned
->
_node
.
hasPK
=
pNode
->
_node
.
hasPK
;
}
else
if
(
pNode
->
nodeType
==
TSQL_NODE_VALUE
)
{
pCloned
->
pVal
=
calloc
(
1
,
sizeof
(
t
Variant
));
pCloned
->
pVal
=
calloc
(
1
,
sizeof
(
S
Variant
));
tVariantAssign
(
pCloned
->
pVal
,
pNode
->
pVal
);
}
else
if
(
pNode
->
nodeType
==
TSQL_NODE_COL
)
{
pCloned
->
pSchema
=
calloc
(
1
,
sizeof
(
SSchema
));
...
...
source/libs/parser/inc/tvariant.h
已删除
100644 → 0
浏览文件 @
885380a1
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_TVARIANT_H
#define TDENGINE_TVARIANT_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include "tarray.h"
#include "ttoken.h"
// variant, each number/string/field_id has a corresponding struct during parsing sql
typedef
struct
SVariant
{
uint32_t
nType
;
int32_t
nLen
;
// only used for string, for number, it is useless
union
{
int64_t
i64
;
uint64_t
u64
;
double
d
;
char
*
pz
;
wchar_t
*
wpz
;
SArray
*
arr
;
// only for 'in' query to hold value list, not value for a field
};
}
SVariant
;
bool
taosVariantIsValid
(
SVariant
*
pVar
);
void
taosVariantCreate
(
SVariant
*
pVar
,
SToken
*
token
);
void
taosVariantCreateFromBinary
(
SVariant
*
pVar
,
const
char
*
pz
,
size_t
len
,
uint32_t
type
);
void
taosVariantDestroy
(
SVariant
*
pV
);
void
taosVariantAssign
(
SVariant
*
pDst
,
const
SVariant
*
pSrc
);
int32_t
taosVariantCompare
(
const
SVariant
*
p1
,
const
SVariant
*
p2
);
int32_t
taosVariantToString
(
SVariant
*
pVar
,
char
*
dst
);
int32_t
taosVariantDump
(
SVariant
*
pVariant
,
char
*
payload
,
int16_t
type
,
bool
includeLengthPrefix
);
#if 0
int32_t taosVariantDumpEx(SVariant *pVariant, char *payload, int16_t type, bool includeLengthPrefix, bool *converted, char *extInfo);
#endif
int32_t
taosVariantTypeSetType
(
SVariant
*
pVariant
,
char
type
);
#ifdef __cplusplus
}
#endif
#endif // TDENGINE_TVARIANT_H
source/libs/parser/src/astGenerator.c
浏览文件 @
819c7fc0
...
...
@@ -13,9 +13,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "os.h"
#include "taos.h"
#include "astGenerator.h"
#include "../../../../include/client/taos.h"
#include "os.h"
int32_t
tStrToInteger
(
const
char
*
z
,
int16_t
type
,
int32_t
n
,
int64_t
*
value
,
bool
issigned
)
{
errno
=
0
;
...
...
source/
common
/src/ttokenizer.c
→
source/
libs/parser
/src/ttokenizer.c
浏览文件 @
819c7fc0
...
...
@@ -15,12 +15,10 @@
#include "os.h"
#include "hash.h"
#include "hashfunc.h"
#include "thash.h"
#include "taosdef.h"
#include "ttoken.h"
#include "ttokendef.h"
#include "tutil.h"
// All the keywords of the SQL language are stored in a hash table
typedef
struct
SKeyword
{
...
...
@@ -575,12 +573,12 @@ uint32_t tGetToken(char* z, uint32_t* tokenId) {
return
0
;
}
S
StrToken
tscReplaceStrToken
(
char
**
str
,
SStr
Token
*
token
,
const
char
*
newToken
)
{
S
Token
tscReplaceStrToken
(
char
**
str
,
S
Token
*
token
,
const
char
*
newToken
)
{
char
*
src
=
*
str
;
size_t
nsize
=
strlen
(
newToken
);
int32_t
size
=
(
int32_t
)
strlen
(
*
str
)
-
token
->
n
+
(
int32_t
)
nsize
+
1
;
int32_t
bsize
=
(
int32_t
)((
uint64_t
)
token
->
z
-
(
uint64_t
)
src
);
S
Str
Token
ntoken
;
SToken
ntoken
;
*
str
=
calloc
(
1
,
size
);
...
...
@@ -596,8 +594,8 @@ SStrToken tscReplaceStrToken(char **str, SStrToken *token, const char* newToken)
return
ntoken
;
}
S
Str
Token
tStrGetToken
(
char
*
str
,
int32_t
*
i
,
bool
isPrevOptr
)
{
S
Str
Token
t0
=
{
0
};
SToken
tStrGetToken
(
char
*
str
,
int32_t
*
i
,
bool
isPrevOptr
)
{
SToken
t0
=
{
0
};
// here we reach the end of sql string, null-terminated string
if
(
str
[
*
i
]
==
0
)
{
...
...
@@ -689,9 +687,9 @@ void taosCleanupKeywordsTable() {
}
}
S
StrToken
taosTokenDup
(
SStr
Token
*
pToken
,
char
*
buf
,
int32_t
len
)
{
S
Token
taosTokenDup
(
S
Token
*
pToken
,
char
*
buf
,
int32_t
len
)
{
assert
(
pToken
!=
NULL
&&
buf
!=
NULL
);
S
Str
Token
token
=
*
pToken
;
SToken
token
=
*
pToken
;
token
.
z
=
buf
;
assert
(
len
>
token
.
n
);
...
...
source/libs/planner/inc/plannerInt.h
浏览文件 @
819c7fc0
...
...
@@ -23,6 +23,7 @@ extern "C" {
#include "common.h"
#include "tarray.h"
#include "planner.h"
#include "taosmsg.h"
typedef
struct
SQueryNodeBasicInfo
{
int32_t
type
;
...
...
source/libs/transport/src/rpcMain.c
浏览文件 @
819c7fc0
...
...
@@ -25,7 +25,7 @@
#include "tglobal.h"
#include "taosmsg.h"
#include "trpc.h"
#include "hash.h"
#include "
t
hash.h"
#include "rpcLog.h"
#include "rpcUdp.h"
#include "rpcCache.h"
...
...
source/server/dnode/inc/dnodeEps.h
浏览文件 @
819c7fc0
...
...
@@ -19,7 +19,7 @@
#ifdef __cplusplus
extern
"C"
{
#endif
#include "hash.h"
#include "
t
hash.h"
#include "dnodeInt.h"
typedef
struct
SDnEps
{
...
...
source/server/dnode/src/dnodeMain.c
浏览文件 @
819c7fc0
...
...
@@ -20,12 +20,12 @@
#if 0
#include "tfs.h"
#endif
#include "tscompression.h"
#include "tnote.h"
#include "ttimer.h"
#include "dnodeCfg.h"
#include "dnodeMain.h"
#include "mnode.h"
#include "tcompression.h"
#include "tnote.h"
#include "ttimer.h"
static
void
dnodeCheckDataDirOpenned
(
char
*
dir
)
{
#if 0
...
...
source/util/src/tcache.c
浏览文件 @
819c7fc0
...
...
@@ -433,7 +433,8 @@ void taosCacheRelease(SCacheObj *pCacheObj, void **data, bool _remove) {
// NOTE: remove it from hash in the first place, otherwise, the pNode may have been released by other thread
// when reaches here.
SCacheDataNode
*
p
=
NULL
;
int32_t
ret
=
taosHashRemoveWithData
(
pCacheObj
->
pHashTable
,
pNode
->
key
,
pNode
->
keySize
,
&
p
,
sizeof
(
void
*
));
int32_t
ret
=
taosHashRemove
(
pCacheObj
->
pHashTable
,
pNode
->
key
,
pNode
->
keySize
);
// int32_t ret = taosHashRemoveWithData(pCacheObj->pHashTable, pNode->key, pNode->keySize, &p, sizeof(void *));
ref
=
T_REF_DEC
(
pNode
);
// successfully remove from hash table, if failed, this node must have been move to trash already, do nothing.
...
...
@@ -641,8 +642,8 @@ void taosTrashcanEmpty(SCacheObj *pCacheObj, bool force) {
}
void
doCleanupDataCache
(
SCacheObj
*
pCacheObj
)
{
SHashTravSupp
sup
=
{.
pCacheObj
=
pCacheObj
,
.
fp
=
NULL
,
.
time
=
taosGetTimestampMs
()};
taosHashCondTraverse
(
pCacheObj
->
pHashTable
,
travHashTableEmptyFn
,
&
sup
);
//
SHashTravSupp sup = {.pCacheObj = pCacheObj, .fp = NULL, .time = taosGetTimestampMs()};
//
taosHashCondTraverse(pCacheObj->pHashTable, travHashTableEmptyFn, &sup);
// todo memory leak if there are object with refcount greater than 0 in hash table?
taosHashCleanup
(
pCacheObj
->
pHashTable
);
...
...
@@ -679,7 +680,7 @@ static void doCacheRefresh(SCacheObj* pCacheObj, int64_t time, __cache_trav_fn_t
assert
(
pCacheObj
!=
NULL
);
SHashTravSupp
sup
=
{.
pCacheObj
=
pCacheObj
,
.
fp
=
fp
,
.
time
=
time
,
.
param1
=
param1
};
taosHashCondTraverse
(
pCacheObj
->
pHashTable
,
travHashTableFn
,
&
sup
);
//
taosHashCondTraverse(pCacheObj->pHashTable, travHashTableFn, &sup);
}
void
taosCacheRefreshWorkerUnexpectedStopped
(
void
)
{
...
...
source/util/src/tcompression.c
浏览文件 @
819c7fc0
...
...
@@ -52,7 +52,7 @@
#ifdef TD_TSZ
#include "td_sz.h"
#endif
#include "t
s
compression.h"
#include "tcompression.h"
#include "ulog.h"
static
const
int
TEST_NUMBER
=
1
;
...
...
source/util/src/thash.c
浏览文件 @
819c7fc0
...
...
@@ -452,6 +452,7 @@ int32_t taosHashRemove(SHashObj *pHashObj, const void *key, size_t keyLen/*, voi
pNode
=
pNode
->
next
;
}
if
(
pNode
)
{
code
=
0
;
// it is found
...
...
source/util/src/thashutil.c
浏览文件 @
819c7fc0
...
...
@@ -163,21 +163,20 @@ _hash_fn_t taosGetDefaultHashFunction(int32_t type) {
return
fn
;
}
int32_t
taosFloatEqual
(
const
void
*
a
,
const
void
*
b
,
size_t
UNUSED_PARAM
(
sz
))
{
return
getComparFunc
(
TSDB_DATA_TYPE_FLOAT
,
-
1
)(
a
,
b
);
}
int32_t
taosDoubleEqual
(
const
void
*
a
,
const
void
*
b
,
size_t
UNUSED_PARAM
(
sz
))
{
return
getComparFunc
(
TSDB_DATA_TYPE_DOUBLE
,
-
1
)(
a
,
b
);
}
//
int32_t taosFloatEqual(const void *a, const void *b, size_t UNUSED_PARAM(sz)) {
// return getComparFunc(TSDB_DATA_TYPE_FLOAT, -1)(a, b);
//
}
//
//
int32_t taosDoubleEqual(const void *a, const void *b, size_t UNUSED_PARAM(sz)) {
// return getComparFunc(TSDB_DATA_TYPE_DOUBLE, -1)(a, b);
//
}
_equal_fn_t
taosGetDefaultEqualFunction
(
int32_t
type
)
{
_equal_fn_t
fn
=
NULL
;
switch
(
type
)
{
case
TSDB_DATA_TYPE_FLOAT
:
fn
=
taosFloatEqual
;
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
fn
=
taosDoubleEqual
;
break
;
default:
fn
=
memcmp
;
break
;
}
//
switch (type) {
// case TSDB_DATA_TYPE_FLOAT: fn = taosFloatEqual; break;
//
case TSDB_DATA_TYPE_DOUBLE: fn = taosDoubleEqual; break;
//
default: fn = memcmp; break;
//
}
return
fn
;
}
src/client/inc/tsclient.h
浏览文件 @
819c7fc0
...
...
@@ -22,8 +22,8 @@ extern "C" {
#include "os.h"
#include "../../../include/client/taos.h"
#include "qAggMain.h"
#include "taos.h"
#include "taosdef.h"
#include "taosmsg.h"
#include "tarray.h"
...
...
src/client/src/TSDBJNIConnector.c
浏览文件 @
819c7fc0
...
...
@@ -13,8 +13,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../../../include/client/taos.h"
#include "os.h"
#include "taos.h"
#include "tlog.h"
#include "tscUtil.h"
...
...
src/client/src/tscLocal.c
浏览文件 @
819c7fc0
...
...
@@ -16,14 +16,14 @@
#include "os.h"
#include "taosmsg.h"
#include "../../../include/client/taos.h"
#include "qTableMeta.h"
#include "taosdef.h"
#include "tname.h"
#include "tscLog.h"
#include "tscSubquery.h"
#include "tscUtil.h"
#include "qTableMeta.h"
#include "tsclient.h"
#include "taos.h"
#include "tscSubquery.h"
#define STR_NOCASE_EQUAL(str1, len1, str2, len2) ((len1 == len2) && 0 == strncasecmp(str1, str2, len1))
...
...
src/client/src/tscParseLineProtocol.c
浏览文件 @
819c7fc0
...
...
@@ -16,7 +16,7 @@
#include "tsclient.h"
#include "tscLog.h"
#include "taos.h"
#include "
../../../include/client/
taos.h"
#include "tscParseLine.h"
typedef
struct
{
...
...
src/client/src/tscParseOpenTSDB.c
浏览文件 @
819c7fc0
...
...
@@ -3,9 +3,9 @@
#include <stdlib.h>
#include <string.h>
#include "../../../include/client/taos.h"
#include "cJSON.h"
#include "hash.h"
#include "taos.h"
#include "tscUtil.h"
#include "tsclient.h"
...
...
src/client/src/tscPrepare.c
浏览文件 @
819c7fc0
...
...
@@ -14,14 +14,14 @@
*/
#include "os.h"
#include "taos.h"
#include "tsclient.h"
#include "tscUtil.h"
#include "ttimer.h"
#include "../../../include/client/taos.h"
#include "taosmsg.h"
#include "tstrbuild.h"
#include "tscLog.h"
#include "tscSubquery.h"
#include "tscUtil.h"
#include "tsclient.h"
#include "tstrbuild.h"
#include "ttimer.h"
int
tsParseInsertSql
(
SSqlObj
*
pSql
);
int32_t
tsCheckTimestamp
(
STableDataBlocks
*
pDataBlocks
,
const
char
*
start
);
...
...
src/client/src/tscProfile.c
浏览文件 @
819c7fc0
...
...
@@ -21,7 +21,7 @@
#include "taosmsg.h"
#include "tcq.h"
#include "taos.h"
#include "
../../../include/client/
taos.h"
#include "tscUtil.h"
void
tscSaveSlowQueryFp
(
void
*
handle
,
void
*
tmrId
);
...
...
src/client/src/tscSQLParser.c
浏览文件 @
819c7fc0
...
...
@@ -21,13 +21,15 @@
#endif // __APPLE__
#include <qSqlparser.h>
#include "../../../include/client/taos.h"
#include "os.h"
#include "
regex
.h"
#include "
qFilter
.h"
#include "qPlan.h"
#include "qScript.h"
#include "qSqlparser.h"
#include "qTableMeta.h"
#include "qUtil.h"
#include "
taos
.h"
#include "
regex
.h"
#include "taosmsg.h"
#include "tcompare.h"
#include "texpr.h"
...
...
@@ -38,9 +40,7 @@
#include "tstrbuild.h"
#include "ttoken.h"
#include "ttokendef.h"
#include "qScript.h"
#include "ttype.h"
#include "qFilter.h"
#define DEFAULT_PRIMARY_TIMESTAMP_COL_NAME "_c0"
...
...
@@ -2232,6 +2232,28 @@ static int32_t doAddProjectionExprAndResultFields(SQueryInfo* pQueryInfo, SColum
return
numOfTotalColumns
;
}
SSchema
tGetUserSpecifiedColumnSchema
(
SVariant
*
pVal
,
SStrToken
*
exprStr
,
const
char
*
name
)
{
SSchema
s
=
{
0
};
s
.
type
=
pVal
->
nType
;
if
(
s
.
type
==
TSDB_DATA_TYPE_BINARY
||
s
.
type
==
TSDB_DATA_TYPE_NCHAR
)
{
s
.
bytes
=
(
int16_t
)(
pVal
->
nLen
+
VARSTR_HEADER_SIZE
);
}
else
{
s
.
bytes
=
tDataTypes
[
pVal
->
nType
].
bytes
;
}
s
.
colId
=
TSDB_UD_COLUMN_INDEX
;
if
(
name
!=
NULL
)
{
tstrncpy
(
s
.
name
,
name
,
sizeof
(
s
.
name
));
}
else
{
size_t
tlen
=
MIN
(
sizeof
(
s
.
name
),
exprStr
->
n
+
1
);
tstrncpy
(
s
.
name
,
exprStr
->
z
,
tlen
);
strdequote
(
s
.
name
);
}
return
s
;
}
int32_t
addProjectionExprAndResultField
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
tSqlExprItem
*
pItem
,
bool
outerQuery
)
{
const
char
*
msg1
=
"tag for normal table query is not allowed"
;
const
char
*
msg2
=
"invalid column name"
;
...
...
src/client/src/tscSub.c
浏览文件 @
819c7fc0
...
...
@@ -13,17 +13,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../../../include/client/taos.h"
#include "os.h"
#include "t
aos
.h"
#include "t
cache
.h"
#include "trpc.h"
#include "tscLog.h"
#include "tscProfile.h"
#include "tscUtil.h"
#include "tsclient.h"
#include "tsocket.h"
#include "ttimer.h"
#include "tutil.h"
#include "tscLog.h"
#include "tscUtil.h"
#include "tcache.h"
#include "tscProfile.h"
typedef
struct
SSubscriptionProgress
{
int64_t
uid
;
...
...
src/connector/odbc/examples/c/main.c
浏览文件 @
819c7fc0
...
...
@@ -9,7 +9,7 @@
#include <sqlext.h>
#include <odbcinst.h>
#include "taos.h"
#include "
../../../../../include/client/
taos.h"
#include "taoserror.h"
#include <stdio.h>
...
...
src/connector/odbc/src/base.h
浏览文件 @
819c7fc0
...
...
@@ -20,7 +20,7 @@
#include "todbc_iconv.h"
#include "todbc_log.h"
#include "taos.h"
#include "
../../../../include/client/
taos.h"
#include "taoserror.h"
#include <sql.h>
...
...
src/connector/odbc/src/todbc_tls.h
浏览文件 @
819c7fc0
...
...
@@ -18,7 +18,7 @@
// !!! functions exported in this header file are all non-thread-safe !!!
#include "taos.h"
#include "
../../../../include/client/
taos.h"
#include "todbc_buf.h"
#include "todbc_iconv.h"
...
...
src/cq/src/cqMain.c
浏览文件 @
819c7fc0
...
...
@@ -20,15 +20,15 @@
#include <stdlib.h>
#include <string.h>
#include "taos.h"
#include "tsclient.h"
#include "../../../include/client/taos.h"
#include "taosdef.h"
#include "taosmsg.h"
#include "ttimer.h"
#include "tcq.h"
#include "tdataformat.h"
#include "tglobal.h"
#include "tlog.h"
#include "tsclient.h"
#include "ttimer.h"
#include "twal.h"
#define cFatal(...) { if (cqDebugFlag & DEBUG_FATAL) { taosPrintLog("CQ FATAL ", 255, __VA_ARGS__); }}
...
...
src/kit/shell/inc/shell.h
浏览文件 @
819c7fc0
...
...
@@ -16,10 +16,9 @@
#ifndef __SHELL__
#define __SHELL__
#include "../../../../include/client/taos.h"
#include "stdbool.h"
#include "taos.h"
#include "taosdef.h"
#include "stdbool.h"
#include "tsclient.h"
#define MAX_USERNAME_SIZE 64
...
...
src/kit/shell/src/shellWindows.c
浏览文件 @
819c7fc0
...
...
@@ -12,9 +12,9 @@
#include <assert.h>
#include <regex.h>
#include <stdio.h>
#include "../../../../include/client/taos.h"
#include "os.h"
#include "shell.h"
#include "taos.h"
#include "shellCommand.h"
extern
char
configDir
[];
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
819c7fc0
...
...
@@ -19,8 +19,8 @@
*/
#include <stdint.h>
#include <taos.h>
#include <taoserror.h>
#include "../../../include/client/taos.h"
#define _GNU_SOURCE
#define CURL_STATICLIB
...
...
@@ -49,8 +49,8 @@
#include <stdlib.h>
#include "cJSON.h"
#include "../../../include/client/taos.h"
#include "os.h"
#include "taos.h"
#include "taoserror.h"
#include "tutil.h"
...
...
src/kit/taosdump/taosdump.c
浏览文件 @
819c7fc0
...
...
@@ -17,15 +17,14 @@
#include <sys/stat.h>
#include <sys/syscall.h>
#include "../../../include/client/taos.h"
#include "os.h"
#include "taos.h"
#include "taosdef.h"
#include "taosmsg.h"
#include "tglobal.h"
#include "tsclient.h"
#include "tsdb.h"
#include "tutil.h"
#include <taos.h>
#define TSDB_SUPPORT_NANOSECOND 1
...
...
src/plugins/http/inc/httpGcJson.h
浏览文件 @
819c7fc0
...
...
@@ -15,9 +15,9 @@
#ifndef TDENGINE_GC_JSON_H
#define TDENGINE_GC_JSON_H
#include "../../../../include/client/taos.h"
#include "httpHandle.h"
#include "httpJson.h"
#include "taos.h"
void
gcInitQueryJson
(
HttpContext
*
pContext
);
void
gcCleanQueryJson
(
HttpContext
*
pContext
);
...
...
src/plugins/http/inc/httpRestJson.h
浏览文件 @
819c7fc0
...
...
@@ -16,9 +16,9 @@
#ifndef TDENGINE_REST_JSON_H
#define TDENGINE_REST_JSON_H
#include <stdbool.h>
#include "../../../../include/client/taos.h"
#include "httpHandle.h"
#include "httpJson.h"
#include "taos.h"
#define REST_JSON_SUCCESS "succ"
#define REST_JSON_SUCCESS_LEN 4
...
...
src/plugins/http/inc/httpTgJson.h
浏览文件 @
819c7fc0
...
...
@@ -16,9 +16,9 @@
#ifndef TDENGINE_TG_JSON_H
#define TDENGINE_TG_JSON_H
#include "../../../../include/client/taos.h"
#include "httpHandle.h"
#include "httpJson.h"
#include "taos.h"
void
tgInitQueryJson
(
HttpContext
*
pContext
);
void
tgCleanQueryJson
(
HttpContext
*
pContext
);
...
...
src/plugins/http/src/httpQueue.c
浏览文件 @
819c7fc0
...
...
@@ -14,18 +14,18 @@
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "tqueue.h"
#include "tnote.h"
#include "taos.h"
#include "tsclient.h"
#include "httpInt.h"
#include "httpQueue.h"
#include "../../../../include/client/taos.h"
#include "httpAuth.h"
#include "httpContext.h"
#include "http
Sql
.h"
#include "http
Int
.h"
#include "httpResp.h"
#include "httpAuth.h"
#include "httpSession.h"
#include "httpQueue.h"
#include "httpSql.h"
#include "os.h"
#include "tnote.h"
#include "tqueue.h"
#include "tsclient.h"
typedef
struct
{
pthread_t
thread
;
...
...
src/plugins/http/src/httpSession.c
浏览文件 @
819c7fc0
...
...
@@ -14,14 +14,14 @@
*/
#define _DEFAULT_SOURCE
#include "httpSession.h"
#include "../../../../include/client/taos.h"
#include "httpContext.h"
#include "httpInt.h"
#include "os.h"
#include "taos.h"
#include "taoserror.h"
#include "tglobal.h"
#include "tcache.h"
#include "httpInt.h"
#include "httpContext.h"
#include "httpSession.h"
#include "tglobal.h"
void
httpCreateSession
(
HttpContext
*
pContext
,
void
*
taos
)
{
HttpServer
*
server
=
&
tsHttpServer
;
...
...
src/plugins/http/src/httpSql.c
浏览文件 @
819c7fc0
...
...
@@ -14,18 +14,18 @@
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "tnote.h"
#include "taos.h"
#include "taoserror.h"
#include "tsclient.h"
#include "httpInt.h"
#include "httpContext.h"
#include "httpSql.h"
#include "
httpResp
.h"
#include "
../../../../include/client/taos
.h"
#include "httpAuth.h"
#include "httpSession.h"
#include "httpContext.h"
#include "httpInt.h"
#include "httpQueue.h"
#include "httpResp.h"
#include "httpSession.h"
#include "os.h"
#include "taoserror.h"
#include "tnote.h"
#include "tsclient.h"
void
httpProcessMultiSql
(
HttpContext
*
pContext
);
...
...
src/plugins/http/src/httpSystem.c
浏览文件 @
819c7fc0
...
...
@@ -14,23 +14,23 @@
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "taos.h"
#include "tglobal.h"
#include "tsocket.h"
#include "ttimer.h"
#include "tadmin.h"
#include "httpInt.h"
#include "../../../../include/client/taos.h"
#include "httpContext.h"
#include "httpSession.h"
#include "httpServer.h"
#include "httpResp.h"
#include "httpGcHandle.h"
#include "httpHandle.h"
#include "httpInt.h"
#include "httpMetricsHandle.h"
#include "httpQueue.h"
#include "http
GcHandle
.h"
#include "http
Resp
.h"
#include "httpRestHandle.h"
#include "httpServer.h"
#include "httpSession.h"
#include "httpTgHandle.h"
#include "httpMetricsHandle.h"
#include "os.h"
#include "tadmin.h"
#include "tglobal.h"
#include "tsocket.h"
#include "ttimer.h"
#ifndef _ADMIN
void
adminInitHandle
(
HttpServer
*
pServer
)
{}
...
...
src/plugins/http/src/httpUtil.c
浏览文件 @
819c7fc0
...
...
@@ -14,13 +14,13 @@
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "tmd5.h"
#include "taos.h"
#include "httpUtil.h"
#include "../../../../include/client/taos.h"
#include "httpInt.h"
#include "httpResp.h"
#include "httpSql.h"
#include "httpUtil.h"
#include "os.h"
#include "tmd5.h"
#include "ttoken.h"
bool
httpCheckUsedbSql
(
char
*
sql
)
{
...
...
src/plugins/mqtt/src/mqttSystem.c
浏览文件 @
819c7fc0
...
...
@@ -14,16 +14,16 @@
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "
../../../../include/client/ta
os.h"
#include "mqtt.h"
#include "mqttInit.h"
#include "mqttLog.h"
#include "mqttPayload.h"
#include "
tmqtt
.h"
#include "
os
.h"
#include "posix_sockets.h"
#include "taos.h"
#include "tglobal.h"
#include "taoserror.h"
#include "tglobal.h"
#include "tmqtt.h"
struct
SMqttReconnectState
tsMqttStatus
=
{
0
};
struct
mqtt_client
tsMqttClient
=
{
0
};
...
...
src/query/inc/qSqlparser.h
浏览文件 @
819c7fc0
...
...
@@ -20,7 +20,7 @@
extern
"C"
{
#endif
#include "taos.h"
#include "
../../../include/client/
taos.h"
#include "taosmsg.h"
#include "tstrbuild.h"
#include "ttoken.h"
...
...
src/query/src/qExtbuffer.c
浏览文件 @
819c7fc0
...
...
@@ -12,16 +12,16 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "qExtbuffer.h"
#include "../../../include/client/taos.h"
#include "os.h"
#include "qAggMain.h"
#include "qExecutor.h"
#include "queryLog.h"
#include "taos.h"
#include "taosdef.h"
#include "taosmsg.h"
#include "tulog.h"
#include "qExecutor.h"
#include "qExtbuffer.h"
#include "tcompare.h"
#include "tulog.h"
#define COLMODEL_GET_VAL(data, schema, allrow, rowId, colId) \
(data + (schema)->pFields[colId].offset * (allrow) + (rowId) * (schema)->pFields[colId].field.bytes)
...
...
tests/comparisonTest/tdengine/tdengineTest.c
浏览文件 @
819c7fc0
#include <inttypes.h>
#include <pthread.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <taos.h>
#include <time.h>
#include <pthread.h>
#include <sys/time.h>
#include <inttypes.h>
#include <time.h>
#include <unistd.h>
#include "../../../include/client/taos.h"
typedef
struct
{
char
sql
[
256
];
...
...
tests/examples/c/apitest.c
浏览文件 @
819c7fc0
...
...
@@ -7,9 +7,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <taos.h>
#include <unistd.h>
#include "../../../include/client/taos.h"
static
void
prepare_data
(
TAOS
*
taos
)
{
TAOS_RES
*
result
;
...
...
tests/examples/c/asyncdemo.c
浏览文件 @
819c7fc0
...
...
@@ -24,7 +24,7 @@
#include <unistd.h>
#include <string.h>
#include
<taos.h>
#include
"../../../include/client/taos.h"
int
points
=
5
;
int
numOfTables
=
3
;
...
...
tests/examples/c/demo.c
浏览文件 @
819c7fc0
...
...
@@ -16,11 +16,11 @@
// TAOS standard API example. The same syntax as MySQL, but only a subset
// to compile: gcc -o demo demo.c -ltaos
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <taos.h> // TAOS header file
#include "../../../include/client/taos.h" // TAOS header file
static
void
queryDB
(
TAOS
*
taos
,
char
*
command
)
{
int
i
;
...
...
tests/examples/c/prepare.c
浏览文件 @
819c7fc0
...
...
@@ -4,8 +4,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "taos.h"
#include "../../../include/client/taos.h"
void
taosMsleep
(
int
mseconds
);
...
...
tests/examples/c/schemaless.c
浏览文件 @
819c7fc0
#include "taos.h"
#include "taoserror.h"
#include "../../../include/client/taos.h"
#include "os.h"
#include "taoserror.h"
#include <stdio.h>
#include <stdlib.h>
...
...
tests/examples/c/stream.c
浏览文件 @
819c7fc0
...
...
@@ -13,12 +13,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <unistd.h>
#include
<taos.h>
// include TDengine header file
#include
"../../../include/client/taos.h"
// include TDengine header file
typedef
struct
{
char
server_ip
[
64
];
...
...
tests/examples/c/subscribe.c
浏览文件 @
819c7fc0
...
...
@@ -4,8 +4,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <taos.h> // include TDengine header file
#include <unistd.h>
#include "../../../include/client/taos.h" // include TDengine header file
int
nTotalRows
;
...
...
tests/examples/lua/lua51/lua_connector51.c
浏览文件 @
819c7fc0
#include <stdio.h>
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "
lua
.h"
#include "
../../../../include/client/taos
.h"
#include "lauxlib.h"
#include "lua.h"
#include "lualib.h"
#include <taos.h>
struct
cb_param
{
lua_State
*
state
;
...
...
tests/examples/lua/lua_connector.c
浏览文件 @
819c7fc0
#include <stdio.h>
#include <lauxlib.h>
#include <lua.h>
#include <lualib.h>
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#include <taos.h>
#include "../../../include/client/taos.h"
struct
cb_param
{
lua_State
*
state
;
...
...
tests/robust/robust.c
浏览文件 @
819c7fc0
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <taos.h>
#include <pthread.h>
#include <sys/time.h>
#include <unistd.h>
#include "../../include/client/taos.h"
typedef
struct
{
char
querySQL
[
256
];
...
...
tests/script/api/batchprepare.c
浏览文件 @
819c7fc0
// TAOS standard API example. The same syntax as MySQL, but only a subet
// to compile: gcc -o prepare prepare.c -ltaos
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "taos.h"
#include <sys/time.h>
#include <pthread.h>
#include <unistd.h>
#include "../../../include/client/taos.h"
typedef
struct
{
TAOS
*
taos
;
...
...
tests/script/api/stmtBatchTest.c
浏览文件 @
819c7fc0
// TAOS standard API example. The same syntax as MySQL, but only a subet
// to compile: gcc -o prepare prepare.c -ltaos
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "taos.h"
#include "taoserror.h"
#include <sys/time.h>
#include <pthread.h>
#include <unistd.h>
#include "../../../include/client/taos.h"
#include "taoserror.h"
#define MAX_ROWS_OF_PER_COLUMN 32770
#define MAX_BINARY_DEF_LEN (1024*16)
...
...
tests/script/api/stmtTest.c
浏览文件 @
819c7fc0
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "taos.h"
#include <sys/time.h>
#include <pthread.h>
#include <unistd.h>
#include "../../../include/client/taos.h"
#define PRINT_ERROR printf("\033[31m");
#define PRINT_SUCCESS printf("\033[32m");
...
...
tests/script/api/stmt_function.c
浏览文件 @
819c7fc0
#include <assert.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "taos.h"
#include <sys/time.h>
#include <pthread.h>
#include <unistd.h>
#include
<assert.h>
#include
"../../../include/client/taos.h"
void
execute_simple_sql
(
void
*
taos
,
char
*
sql
)
{
TAOS_RES
*
result
=
taos_query
(
taos
,
sql
);
...
...
tests/test/c/cacheTest.c
浏览文件 @
819c7fc0
...
...
@@ -15,8 +15,8 @@
#define _DEFAULT_SOURCE
#include <malloc.h>
#include "../../../include/client/taos.h"
#include "os.h"
#include "taos.h"
#include "tcache.h"
#include "tulog.h"
#include "tutil.h"
...
...
tests/test/c/createNormalTable.c
浏览文件 @
819c7fc0
...
...
@@ -14,13 +14,13 @@
*/
#define _DEFAULT_SOURCE
#include "../../../include/client/taos.h"
#include "hash.h"
#include "os.h"
#include "taoserror.h"
#include "t
aos
.h"
#include "t
global
.h"
#include "tulog.h"
#include "tutil.h"
#include "tglobal.h"
#include "hash.h"
#define MAX_RANDOM_POINTS 20000
#define GREEN "\033[1;32m"
...
...
tests/test/c/createTablePerformance.c
浏览文件 @
819c7fc0
...
...
@@ -14,13 +14,13 @@
*/
#define _DEFAULT_SOURCE
#include "../../../include/client/taos.h"
#include "hash.h"
#include "os.h"
#include "taoserror.h"
#include "t
aos
.h"
#include "t
global
.h"
#include "tulog.h"
#include "tutil.h"
#include "tglobal.h"
#include "hash.h"
#define MAX_RANDOM_POINTS 20000
#define GREEN "\033[1;32m"
...
...
tests/test/c/hashIterator.c
浏览文件 @
819c7fc0
...
...
@@ -14,11 +14,11 @@
*/
#define _DEFAULT_SOURCE
#include "../../../include/client/taos.h"
#include "hash.h"
#include "os.h"
#include "taos.h"
#include "tulog.h"
#include "tutil.h"
#include "hash.h"
typedef
struct
HashTestRow
{
int32_t
keySize
;
...
...
tests/test/c/hashPerformance.c
浏览文件 @
819c7fc0
...
...
@@ -14,11 +14,11 @@
*/
#define _DEFAULT_SOURCE
#include "../../../include/client/taos.h"
#include "hash.h"
#include "os.h"
#include "taos.h"
#include "tulog.h"
#include "tutil.h"
#include "hash.h"
#define MAX_RANDOM_POINTS 20000
#define GREEN "\033[1;32m"
...
...
tests/test/c/importOneRow.c
浏览文件 @
819c7fc0
...
...
@@ -14,12 +14,12 @@
*/
#define _DEFAULT_SOURCE
#include "../../../include/client/taos.h"
#include "os.h"
#include "taos.h"
#include "tulog.h"
#include "tglobal.h"
#include "ttimer.h"
#include "tulog.h"
#include "tutil.h"
#include "tglobal.h"
#define MAX_RANDOM_POINTS 20000
#define GREEN "\033[1;32m"
...
...
tests/test/c/importPerTable.c
浏览文件 @
819c7fc0
...
...
@@ -14,13 +14,13 @@
*/
#define _DEFAULT_SOURCE
#include "../../../include/client/taos.h"
#include "os.h"
#include "
taos
.h"
#include "t
ulog
.h"
#include "
osTime
.h"
#include "t
global
.h"
#include "ttimer.h"
#include "tulog.h"
#include "tutil.h"
#include "tglobal.h"
#include "osTime.h"
#define MAX_RANDOM_POINTS 20000
#define GREEN "\033[1;32m"
...
...
tests/test/c/insertPerRow.c
浏览文件 @
819c7fc0
...
...
@@ -14,12 +14,12 @@
*/
#define _DEFAULT_SOURCE
#include "../../../include/client/taos.h"
#include "os.h"
#include "taos.h"
#include "tulog.h"
#include "tglobal.h"
#include "ttimer.h"
#include "tulog.h"
#include "tutil.h"
#include "tglobal.h"
#define MAX_RANDOM_POINTS 20000
#define GREEN "\033[1;32m"
...
...
tests/test/c/insertPerTable.c
浏览文件 @
819c7fc0
...
...
@@ -14,12 +14,12 @@
*/
#define _DEFAULT_SOURCE
#include "../../../include/client/taos.h"
#include "os.h"
#include "taos.h"
#include "tulog.h"
#include "tglobal.h"
#include "ttimer.h"
#include "tulog.h"
#include "tutil.h"
#include "tglobal.h"
#define MAX_RANDOM_POINTS 20000
#define GREEN "\033[1;32m"
...
...
tests/test/c/invalidTableId.c
浏览文件 @
819c7fc0
...
...
@@ -14,13 +14,13 @@
*/
#define _DEFAULT_SOURCE
#include "../../../include/client/taos.h"
#include "hash.h"
#include "os.h"
#include "taoserror.h"
#include "t
aos
.h"
#include "t
global
.h"
#include "tulog.h"
#include "tutil.h"
#include "tglobal.h"
#include "hash.h"
#define MAX_RANDOM_POINTS 20000
#define GREEN "\033[1;32m"
...
...
tests/test/c/queryPerformance.c
浏览文件 @
819c7fc0
...
...
@@ -14,12 +14,12 @@
*/
#define _DEFAULT_SOURCE
#include "../../../include/client/taos.h"
#include "os.h"
#include "taos.h"
#include "tulog.h"
#include "tglobal.h"
#include "ttimer.h"
#include "tulog.h"
#include "tutil.h"
#include "tglobal.h"
#define MAX_RANDOM_POINTS 20000
#define GREEN "\033[1;32m"
...
...
tests/tsim/inc/sim.h
浏览文件 @
819c7fc0
...
...
@@ -20,7 +20,7 @@
#include <stdbool.h>
#include <stdint.h>
#include "taos.h"
#include "
../../../include/client/
taos.h"
#include "tidpool.h"
#include "tlog.h"
#include "tutil.h"
...
...
tests/tsim/src/simExe.c
浏览文件 @
819c7fc0
...
...
@@ -14,13 +14,13 @@
*/
#define _DEFAULT_SOURCE
#include "../../../include/client/taos.h"
#include "cJSON.h"
#include "os.h"
#include "sim.h"
#include "taos.h"
#include "taoserror.h"
#include "tglobal.h"
#include "tutil.h"
#include "cJSON.h"
#undef TAOS_MEM_CHECK
void
simLogSql
(
char
*
sql
,
bool
useSharp
)
{
...
...
tests/tsim/src/simSystem.c
浏览文件 @
819c7fc0
...
...
@@ -14,14 +14,14 @@
*/
#define _DEFAULT_SOURCE
#include "../../../include/client/taos.h"
#include "os.h"
#include "sim.h"
#include "taos.h"
#include "taos
error
.h"
#include "tglobal.h"
#include "tsocket.h"
#include "ttimer.h"
#include "tutil.h"
#include "tsocket.h"
#include "taoserror.h"
#undef TAOS_MEM_CHECK
SScript
*
simScriptList
[
MAX_MAIN_SCRIPT_NUM
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录