Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
哥们要飞
TDengine
提交
901803ab
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,发现更多精彩内容 >>
提交
901803ab
编写于
9月 25, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-1604]
上级
2b909bc1
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
23 addition
and
31 deletion
+23
-31
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+1
-1
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+21
-23
src/client/src/tscPrepare.c
src/client/src/tscPrepare.c
+0
-6
src/inc/taoserror.h
src/inc/taoserror.h
+1
-1
未找到文件。
src/client/src/tscAsync.c
浏览文件 @
901803ab
...
...
@@ -509,7 +509,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
goto
_error
;
}
if
(
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_STMT_INSERT
)
)
{
if
(
pCmd
->
insertType
==
TSDB_QUERY_TYPE_STMT_INSERT
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
code
=
tscGetTableMeta
(
pSql
,
pTableMetaInfo
);
if
(
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
...
...
src/client/src/tscParseInsert.c
浏览文件 @
901803ab
...
...
@@ -406,7 +406,7 @@ static int32_t tsCheckTimestamp(STableDataBlocks *pDataBlocks, const char *start
return
TSDB_CODE_SUCCESS
;
}
int
tsParseOneRowData
(
char
**
str
,
STableDataBlocks
*
pDataBlocks
,
SSchema
schema
[],
SParsedDataColInfo
*
spd
,
char
*
error
,
int
tsParseOneRowData
(
char
**
str
,
STableDataBlocks
*
pDataBlocks
,
SSchema
schema
[],
SParsedDataColInfo
*
spd
,
SSqlCmd
*
pCmd
,
int16_t
timePrec
,
int32_t
*
code
,
char
*
tmpTokenBuf
)
{
int32_t
index
=
0
;
SStrToken
sToken
=
{
0
};
...
...
@@ -426,12 +426,17 @@ int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SSchema schema[
*
str
+=
index
;
if
(
sToken
.
type
==
TK_QUESTION
)
{
if
(
pCmd
->
insertType
!=
TSDB_QUERY_TYPE_STMT_INSERT
)
{
*
code
=
tscSQLSyntaxErrMsg
(
pCmd
->
payload
,
"? only allowed in binding insertion"
,
*
str
);
return
-
1
;
}
uint32_t
offset
=
(
uint32_t
)(
start
-
pDataBlocks
->
pData
);
if
(
tscAddParamToDataBlock
(
pDataBlocks
,
pSchema
->
type
,
(
uint8_t
)
timePrec
,
pSchema
->
bytes
,
offset
)
!=
NULL
)
{
continue
;
}
strcpy
(
error
,
"client out of memory"
);
strcpy
(
pCmd
->
payload
,
"client out of memory"
);
*
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
-
1
;
}
...
...
@@ -439,8 +444,7 @@ int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SSchema schema[
int16_t
type
=
sToken
.
type
;
if
((
type
!=
TK_NOW
&&
type
!=
TK_INTEGER
&&
type
!=
TK_STRING
&&
type
!=
TK_FLOAT
&&
type
!=
TK_BOOL
&&
type
!=
TK_NULL
&&
type
!=
TK_HEX
&&
type
!=
TK_OCT
&&
type
!=
TK_BIN
)
||
(
sToken
.
n
==
0
)
||
(
type
==
TK_RP
))
{
tscSQLSyntaxErrMsg
(
error
,
"invalid data or symbol"
,
sToken
.
z
);
*
code
=
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
*
code
=
tscSQLSyntaxErrMsg
(
pCmd
->
payload
,
"invalid data or symbol"
,
sToken
.
z
);
return
-
1
;
}
...
...
@@ -470,14 +474,14 @@ int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SSchema schema[
}
bool
isPrimaryKey
=
(
colIndex
==
PRIMARYKEY_TIMESTAMP_COL_INDEX
);
int32_t
ret
=
tsParseOneColumnData
(
pSchema
,
&
sToken
,
start
,
error
,
str
,
isPrimaryKey
,
timePrec
);
int32_t
ret
=
tsParseOneColumnData
(
pSchema
,
&
sToken
,
start
,
pCmd
->
payload
,
str
,
isPrimaryKey
,
timePrec
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
*
code
=
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
return
-
1
;
// NOTE: here 0 mean error!
}
if
(
isPrimaryKey
&&
tsCheckTimestamp
(
pDataBlocks
,
start
)
!=
TSDB_CODE_SUCCESS
)
{
tscInvalidSQLErrMsg
(
error
,
"client time/server time can not be mixed up"
,
sToken
.
z
);
tscInvalidSQLErrMsg
(
pCmd
->
payload
,
"client time/server time can not be mixed up"
,
sToken
.
z
);
*
code
=
TSDB_CODE_TSC_INVALID_TIME_STAMP
;
return
-
1
;
}
...
...
@@ -522,7 +526,7 @@ static int32_t rowDataCompar(const void *lhs, const void *rhs) {
}
int
tsParseValues
(
char
**
str
,
STableDataBlocks
*
pDataBlock
,
STableMeta
*
pTableMeta
,
int
maxRows
,
SParsedDataColInfo
*
spd
,
char
*
error
,
int32_t
*
code
,
char
*
tmpTokenBuf
)
{
SParsedDataColInfo
*
spd
,
SSqlCmd
*
pCmd
,
int32_t
*
code
,
char
*
tmpTokenBuf
)
{
int32_t
index
=
0
;
SStrToken
sToken
;
...
...
@@ -534,8 +538,7 @@ int tsParseValues(char **str, STableDataBlocks *pDataBlock, STableMeta *pTableMe
int32_t
precision
=
tinfo
.
precision
;
if
(
spd
->
hasVal
[
0
]
==
false
)
{
strcpy
(
error
,
"primary timestamp column can not be null"
);
*
code
=
TSDB_CODE_TSC_INVALID_SQL
;
*
code
=
tscInvalidSQLErrMsg
(
pCmd
->
payload
,
"primary timestamp column can not be null"
,
*
str
);
return
-
1
;
}
...
...
@@ -547,17 +550,17 @@ int tsParseValues(char **str, STableDataBlocks *pDataBlock, STableMeta *pTableMe
*
str
+=
index
;
if
(
numOfRows
>=
maxRows
||
pDataBlock
->
size
+
tinfo
.
rowSize
>=
pDataBlock
->
nAllocSize
)
{
int32_t
tSize
;
int32_t
retcode
=
tscAllocateMemIfNeed
(
pDataBlock
,
tinfo
.
rowSize
,
&
tSize
);
if
(
retcode
!=
TSDB_CODE_SUCCESS
)
{
//TODO pass the correct error code to client
strcpy
(
error
,
"client out of memory"
);
*
code
=
retcode
;
*
code
=
tscAllocateMemIfNeed
(
pDataBlock
,
tinfo
.
rowSize
,
&
tSize
);
if
(
*
code
!=
TSDB_CODE_SUCCESS
)
{
//TODO pass the correct error code to client
strcpy
(
pCmd
->
payload
,
"client out of memory"
);
return
-
1
;
}
ASSERT
(
tSize
>
maxRows
);
maxRows
=
tSize
;
}
int32_t
len
=
tsParseOneRowData
(
str
,
pDataBlock
,
pSchema
,
spd
,
error
,
precision
,
code
,
tmpTokenBuf
);
int32_t
len
=
tsParseOneRowData
(
str
,
pDataBlock
,
pSchema
,
spd
,
pCmd
,
precision
,
code
,
tmpTokenBuf
);
if
(
len
<=
0
)
{
// error message has been set in tsParseOneRowData
return
-
1
;
}
...
...
@@ -568,7 +571,7 @@ int tsParseValues(char **str, STableDataBlocks *pDataBlock, STableMeta *pTableMe
sToken
=
tStrGetToken
(
*
str
,
&
index
,
false
,
0
,
NULL
);
*
str
+=
index
;
if
(
sToken
.
n
==
0
||
sToken
.
type
!=
TK_RP
)
{
tscSQLSyntaxErrMsg
(
error
,
") expected"
,
*
str
);
tscSQLSyntaxErrMsg
(
pCmd
->
payload
,
") expected"
,
*
str
);
*
code
=
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
return
-
1
;
}
...
...
@@ -577,7 +580,7 @@ int tsParseValues(char **str, STableDataBlocks *pDataBlock, STableMeta *pTableMe
}
if
(
numOfRows
<=
0
)
{
strcpy
(
error
,
"no any data points"
);
strcpy
(
pCmd
->
payload
,
"no any data points"
);
*
code
=
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
return
-
1
;
}
else
{
...
...
@@ -704,7 +707,7 @@ static int32_t doParseInsertStatement(SSqlObj *pSql, void *pTableList, char **st
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
int32_t
numOfRows
=
tsParseValues
(
str
,
dataBuf
,
pTableMeta
,
maxNumOfRows
,
spd
,
pCmd
->
payload
,
&
code
,
tmpTokenBuf
);
int32_t
numOfRows
=
tsParseValues
(
str
,
dataBuf
,
pTableMeta
,
maxNumOfRows
,
spd
,
pCmd
,
&
code
,
tmpTokenBuf
);
free
(
tmpTokenBuf
);
if
(
numOfRows
<=
0
)
{
return
code
;
...
...
@@ -724,10 +727,6 @@ static int32_t doParseInsertStatement(SSqlObj *pSql, void *pTableList, char **st
dataBuf
->
vgId
=
pTableMeta
->
vgroupInfo
.
vgId
;
dataBuf
->
numOfTables
=
1
;
/*
* the value of pRes->numOfRows does not affect the true result of AFFECTED ROWS,
* which is actually returned from server.
*/
*
totalNum
+=
numOfRows
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -1459,8 +1458,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) {
char
*
lineptr
=
line
;
strtolower
(
line
,
line
);
int32_t
len
=
tsParseOneRowData
(
&
lineptr
,
pTableDataBlock
,
pSchema
,
&
spd
,
pCmd
->
payload
,
tinfo
.
precision
,
&
code
,
tokenBuf
);
int32_t
len
=
tsParseOneRowData
(
&
lineptr
,
pTableDataBlock
,
pSchema
,
&
spd
,
pCmd
,
tinfo
.
precision
,
&
code
,
tokenBuf
);
if
(
len
<=
0
||
pTableDataBlock
->
numOfParams
>
0
)
{
pSql
->
res
.
code
=
code
;
break
;
...
...
src/client/src/tscPrepare.c
浏览文件 @
901803ab
...
...
@@ -43,10 +43,6 @@ typedef struct SNormalStmt {
tVariant
*
params
;
}
SNormalStmt
;
//typedef struct SInsertStmt {
//
//} SInsertStmt;
typedef
struct
STscStmt
{
bool
isInsert
;
STscObj
*
taos
;
...
...
@@ -54,7 +50,6 @@ typedef struct STscStmt {
SNormalStmt
normal
;
}
STscStmt
;
static
int
normalStmtAddPart
(
SNormalStmt
*
stmt
,
bool
isParam
,
char
*
str
,
uint32_t
len
)
{
uint16_t
size
=
stmt
->
numParts
+
1
;
if
(
size
>
stmt
->
sizeParts
)
{
...
...
@@ -514,7 +509,6 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
SSqlObj
*
pSql
=
pStmt
->
pSql
;
size_t
sqlLen
=
strlen
(
sql
);
//doAsyncQuery(pObj, pSql, waitForQueryRsp, taos, sqlstr, sqlLen);
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
pSql
->
param
=
(
void
*
)
pSql
;
...
...
src/inc/taoserror.h
浏览文件 @
901803ab
...
...
@@ -98,7 +98,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSC_ACTION_IN_PROGRESS, 0, 0x0212, "Action in
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_DISCONNECTED
,
0
,
0x0213
,
"Disconnected from service"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_NO_WRITE_AUTH
,
0
,
0x0214
,
"No write permission"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_CONN_KILLED
,
0
,
0x0215
,
"Connection killed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
,
0
,
0x0216
,
"Syntax errr in SQL"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
,
0
,
0x0216
,
"Syntax err
o
r in SQL"
)
// mnode
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_MSG_NOT_PROCESSED
,
0
,
0x0300
,
"Message not processed"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录