mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 16:50:48 +00:00
Fix JDBC @@session.variables
This commit is contained in:
parent
2eba81347b
commit
71f1a3120e
@ -52,7 +52,7 @@ public:
|
||||
String variable_name = assert_cast<const ColumnConst &>(*arguments[0].column).getValue<String>();
|
||||
auto variable = global_variable_map.find(Poco::toLower(variable_name));
|
||||
if (variable == global_variable_map.end())
|
||||
return std::make_shared<DataTypeString>();
|
||||
return std::make_shared<DataTypeInt32>();
|
||||
else
|
||||
return variable->second.type;
|
||||
}
|
||||
@ -63,10 +63,8 @@ public:
|
||||
String variable_name = assert_cast<const ColumnConst &>(*col.column).getValue<String>();
|
||||
auto variable = global_variable_map.find(Poco::toLower(variable_name));
|
||||
|
||||
Field val;
|
||||
if (variable == global_variable_map.end())
|
||||
val = "";
|
||||
else
|
||||
Field val = 0;
|
||||
if (variable != global_variable_map.end())
|
||||
val = variable->second.value;
|
||||
|
||||
auto & result_col = block.getByPosition(result);
|
||||
|
@ -1270,6 +1270,19 @@ bool ParserMySQLGlobalVariable::parseImpl(Pos & pos, ASTPtr & node, Expected & e
|
||||
String name(pos->begin, pos->end);
|
||||
++pos;
|
||||
|
||||
/// SELECT @@session|global.variable style
|
||||
if (pos->type == TokenType::Dot)
|
||||
{
|
||||
++pos;
|
||||
|
||||
if (pos->type != TokenType::BareWord)
|
||||
{
|
||||
expected.add(pos, "variable name");
|
||||
return false;
|
||||
}
|
||||
name = String(pos->begin, pos->end);
|
||||
}
|
||||
|
||||
auto name_literal = std::make_shared<ASTLiteral>(name);
|
||||
|
||||
auto expr_list_args = std::make_shared<ASTExpressionList>();
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
0
|
||||
"max_allowed_packet"
|
||||
67108864
|
||||
"MAX_ALLOWED_PACKET"
|
||||
@ -7,3 +7,5 @@
|
||||
67108864,0
|
||||
67108864,1
|
||||
67108864,2
|
||||
"auto_increment_increment"
|
||||
0
|
||||
|
@ -2,3 +2,4 @@ SELECT @@test; -- empty string
|
||||
SELECT @@max_allowed_packet FORMAT CSVWithNames;
|
||||
SELECT @@MAX_ALLOWED_PACKET FORMAT CSVWithNames;
|
||||
SELECT @@max_allowed_packet, number FROM system.numbers LIMIT 3 FORMAT CSVWithNames;
|
||||
SELECT @@session.auto_increment_increment FORMAT CSVWithNames;
|
||||
|
Loading…
Reference in New Issue
Block a user