Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
08f85804
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
08f85804
编写于
3月 26, 2019
作者:
V
Vitaly Baranov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Send query settings before data from client to server.
Apply query settings only for the containing query (client).
上级
a78e067c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
13 deletion
+26
-13
dbms/programs/client/Client.cpp
dbms/programs/client/Client.cpp
+26
-13
未找到文件。
dbms/programs/client/Client.cpp
浏览文件 @
08f85804
...
...
@@ -796,14 +796,33 @@ private:
written_progress_chars
=
0
;
written_first_block
=
false
;
connection
->
forceConnected
();
{
/// Temporarily apply query settings to context.
std
::
optional
<
Settings
>
old_settings
;
SCOPE_EXIT
({
if
(
old_settings
)
context
.
setSettings
(
*
old_settings
);
});
auto
apply_query_settings
=
[
&
](
const
IAST
&
settings_ast
)
{
if
(
!
old_settings
)
old_settings
.
emplace
(
context
.
getSettingsRef
());
for
(
const
auto
&
change
:
settings_ast
.
as
<
ASTSetQuery
>
()
->
changes
)
context
.
setSetting
(
change
.
name
,
change
.
value
);
};
const
auto
*
insert
=
parsed_query
->
as
<
ASTInsertQuery
>
();
if
(
insert
&&
insert
->
settings_ast
)
apply_query_settings
(
*
insert
->
settings_ast
);
/// FIXME: try to prettify this cast using `as<>()`
const
auto
*
with_output
=
dynamic_cast
<
const
ASTQueryWithOutput
*>
(
parsed_query
.
get
());
if
(
with_output
&&
with_output
->
settings_ast
)
apply_query_settings
(
*
with_output
->
settings_ast
);
/// INSERT query for which data transfer is needed (not an INSERT SELECT) is processed separately.
const
auto
*
insert_query
=
parsed_query
->
as
<
ASTInsertQuery
>
();
if
(
insert_query
&&
!
insert_query
->
select
)
processInsertQuery
();
else
processOrdinaryQuery
();
connection
->
forceConnected
();
/// INSERT query for which data transfer is needed (not an INSERT SELECT) is processed separately.
if
(
insert
&&
!
insert
->
select
)
processInsertQuery
();
else
processOrdinaryQuery
();
}
/// Do not change context (current DB, settings) in case of an exception.
if
(
!
got_exception
)
...
...
@@ -963,8 +982,6 @@ private:
{
if
(
!
insert
->
format
.
empty
())
current_format
=
insert
->
format
;
if
(
insert
->
settings_ast
)
InterpreterSetQuery
(
insert
->
settings_ast
,
context
).
executeForCurrentContext
();
}
BlockInputStreamPtr
block_input
=
context
.
getInputFormat
(
...
...
@@ -1247,10 +1264,6 @@ private:
const
auto
&
id
=
query_with_output
->
format
->
as
<
ASTIdentifier
&>
();
current_format
=
id
.
name
;
}
if
(
query_with_output
->
settings_ast
)
{
InterpreterSetQuery
(
query_with_output
->
settings_ast
,
context
).
executeForCurrentContext
();
}
}
if
(
has_vertical_output_suffix
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录