Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
25d959b9
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
25d959b9
编写于
4月 02, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225]fix error in import files.
上级
a772612b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
57 addition
and
57 deletion
+57
-57
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+57
-57
未找到文件。
src/client/src/tscParseInsert.c
浏览文件 @
25d959b9
...
...
@@ -1114,7 +1114,7 @@ int tsParseInsertSql(SSqlObj *pSql) {
}
pCmd
->
curSql
=
sToken
.
z
;
char
buf
[
TSDB_TABLE_FNAME_LEN
];
char
buf
[
TSDB_TABLE_FNAME_LEN
];
SStrToken
sTblToken
;
sTblToken
.
z
=
buf
;
// Check if the table name available or not
...
...
@@ -1127,7 +1127,7 @@ int tsParseInsertSql(SSqlObj *pSql) {
goto
_clean
;
}
char
*
bindedColumns
=
NULL
;
char
*
bindedColumns
=
NULL
;
if
((
code
=
tscCheckIfCreateTable
(
&
str
,
pSql
,
&
bindedColumns
))
!=
TSDB_CODE_SUCCESS
)
{
/*
* After retrieving the table meta from server, the sql string will be parsed from the paused position.
...
...
@@ -1136,7 +1136,7 @@ int tsParseInsertSql(SSqlObj *pSql) {
if
(
TSDB_CODE_TSC_ACTION_IN_PROGRESS
==
code
)
{
return
code
;
}
tscError
(
"%p async insert parse error, code:%s"
,
pSql
,
tstrerror
(
code
));
pCmd
->
curSql
=
NULL
;
goto
_clean
;
...
...
@@ -1151,32 +1151,13 @@ int tsParseInsertSql(SSqlObj *pSql) {
sToken
=
tStrGetToken
(
str
,
&
index
,
false
);
str
+=
index
;
if
(
sToken
.
n
==
0
)
{
if
(
sToken
.
n
==
0
||
(
sToken
.
type
!=
TK_FILE
&&
sToken
.
type
!=
TK_VALUES
)
)
{
code
=
tscInvalidSQLErrMsg
(
pCmd
->
payload
,
"keyword VALUES or FILE required"
,
sToken
.
z
);
goto
_clean
;
}
STableComInfo
tinfo
=
tscGetTableInfo
(
pTableMetaInfo
->
pTableMeta
);
if
(
bindedColumns
==
NULL
)
{
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
if
(
validateDataSource
(
pCmd
,
DATA_FROM_SQL_STRING
,
sToken
.
z
)
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean
;
}
STableDataBlocks
*
dataBuf
=
NULL
;
int32_t
ret
=
tscGetDataBlockFromList
(
pCmd
->
pTableBlockHashList
,
pTableMeta
->
id
.
uid
,
TSDB_DEFAULT_PAYLOAD_SIZE
,
sizeof
(
SSubmitBlk
),
tinfo
.
rowSize
,
&
pTableMetaInfo
->
name
,
pTableMeta
,
&
dataBuf
,
NULL
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean
;
}
code
=
doParseInsertStatement
(
pCmd
,
&
str
,
dataBuf
,
&
totalNum
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean
;
}
}
else
if
(
sToken
.
type
==
TK_FILE
)
{
STableComInfo
tinfo
=
tscGetTableInfo
(
pTableMetaInfo
->
pTableMeta
);
if
(
sToken
.
type
==
TK_FILE
)
{
if
(
validateDataSource
(
pCmd
,
DATA_FROM_DATA_FILE
,
sToken
.
z
)
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean
;
}
...
...
@@ -1206,44 +1187,63 @@ int tsParseInsertSql(SSqlObj *pSql) {
tstrncpy
(
pCmd
->
payload
,
full_path
.
we_wordv
[
0
],
pCmd
->
allocSize
);
wordfree
(
&
full_path
);
}
else
if
(
bindedColumns
!=
NULL
)
{
// insert into tablename(col1, col2,..., coln) values(v1, v2,... vn);
STableMeta
*
pTableMeta
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
)
->
pTableMeta
;
}
else
{
if
(
bindedColumns
==
NULL
)
{
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
if
(
validateDataSource
(
pCmd
,
DATA_FROM_SQL_STRING
,
sToken
.
z
)
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean
;
}
if
(
validateDataSource
(
pCmd
,
DATA_FROM_SQL_STRING
,
sToken
.
z
)
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean
;
}
STableDataBlocks
*
dataBuf
=
NULL
;
int32_t
ret
=
tscGetDataBlockFromList
(
pCmd
->
pTableBlockHashList
,
pTableMeta
->
id
.
uid
,
TSDB_DEFAULT_PAYLOAD_SIZE
,
sizeof
(
SSubmitBlk
),
tinfo
.
rowSize
,
&
pTableMetaInfo
->
name
,
pTableMeta
,
&
dataBuf
,
NULL
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean
;
}
STableDataBlocks
*
dataBuf
=
NULL
;
int32_t
ret
=
tscGetDataBlockFromList
(
pCmd
->
pTableBlockHashList
,
pTableMeta
->
id
.
uid
,
TSDB_DEFAULT_PAYLOAD_SIZE
,
sizeof
(
SSubmitBlk
),
tinfo
.
rowSize
,
&
pTableMetaInfo
->
name
,
pTableMeta
,
&
dataBuf
,
NULL
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean
;
}
SSchema
*
pSchema
=
tscGetTableSchema
(
pTableMeta
);
code
=
parseBoundColumns
(
pCmd
,
&
dataBuf
->
boundColumnInfo
,
pSchema
,
bindedColumns
,
NULL
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean
;
}
code
=
doParseInsertStatement
(
pCmd
,
&
str
,
dataBuf
,
&
totalNum
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean
;
}
}
else
{
// bindedColumns != NULL
// insert into tablename(col1, col2,..., coln) values(v1, v2,... vn);
STableMeta
*
pTableMeta
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
)
->
pTableMeta
;
if
(
dataBuf
->
boundColumnInfo
.
cols
[
0
].
hasVal
==
false
)
{
code
=
tscInvalidSQLErrMsg
(
pCmd
->
payload
,
"primary timestamp column can not be null"
,
NULL
);
goto
_clean
;
}
if
(
validateDataSource
(
pCmd
,
DATA_FROM_SQL_STRING
,
sToken
.
z
)
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean
;
}
if
(
sToken
.
type
!=
TK_VALUES
)
{
code
=
tscInvalidSQLErrMsg
(
pCmd
->
payload
,
"keyword VALUES is expected"
,
sToken
.
z
);
goto
_clean
;
}
STableDataBlocks
*
dataBuf
=
NULL
;
int32_t
ret
=
tscGetDataBlockFromList
(
pCmd
->
pTableBlockHashList
,
pTableMeta
->
id
.
uid
,
TSDB_DEFAULT_PAYLOAD_SIZE
,
sizeof
(
SSubmitBlk
),
tinfo
.
rowSize
,
&
pTableMetaInfo
->
name
,
pTableMeta
,
&
dataBuf
,
NULL
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean
;
}
code
=
doParseInsertStatement
(
pCmd
,
&
str
,
dataBuf
,
&
totalNum
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean
;
SSchema
*
pSchema
=
tscGetTableSchema
(
pTableMeta
);
code
=
parseBoundColumns
(
pCmd
,
&
dataBuf
->
boundColumnInfo
,
pSchema
,
bindedColumns
,
NULL
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean
;
}
if
(
dataBuf
->
boundColumnInfo
.
cols
[
0
].
hasVal
==
false
)
{
code
=
tscInvalidSQLErrMsg
(
pCmd
->
payload
,
"primary timestamp column can not be null"
,
NULL
);
goto
_clean
;
}
if
(
sToken
.
type
!=
TK_VALUES
)
{
code
=
tscInvalidSQLErrMsg
(
pCmd
->
payload
,
"keyword VALUES is expected"
,
sToken
.
z
);
goto
_clean
;
}
code
=
doParseInsertStatement
(
pCmd
,
&
str
,
dataBuf
,
&
totalNum
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean
;
}
}
}
else
{
code
=
tscInvalidSQLErrMsg
(
pCmd
->
payload
,
"keyword VALUES or FILE are required"
,
sToken
.
z
);
goto
_clean
;
}
}
...
...
@@ -1460,7 +1460,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow
strtolower
(
line
,
line
);
int32_t
len
=
0
;
code
=
tsParseOneRow
(
&
lineptr
,
pTableDataBlock
,
pCmd
,
tinfo
.
precision
,
&
code
,
tokenBuf
);
code
=
tsParseOneRow
(
&
lineptr
,
pTableDataBlock
,
pCmd
,
tinfo
.
precision
,
&
len
,
tokenBuf
);
if
(
code
!=
TSDB_CODE_SUCCESS
||
pTableDataBlock
->
numOfParams
>
0
)
{
pSql
->
res
.
code
=
code
;
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录