dbms: development [#CONV-2944].

This commit is contained in:
Alexey Milovidov 2011-08-13 21:14:02 +00:00
parent 532a578b7a
commit e29501b7d4

View File

@ -144,14 +144,15 @@ void Expression::executeImpl(ASTPtr ast, Block & block)
/// Вставляем в блок столбцы - результаты вычисления функции /// Вставляем в блок столбцы - результаты вычисления функции
ColumnNumbers argument_numbers; ColumnNumbers argument_numbers;
ColumnNumbers result_numbers; ColumnNumbers & result_numbers = node->return_column_numbers;
result_numbers.clear();
size_t res_num = 0; size_t res_num = 0;
for (DataTypes::const_iterator it = node->return_types.begin(); it != node->return_types.end(); ++it) for (DataTypes::const_iterator it = node->return_types.begin(); it != node->return_types.end(); ++it)
{ {
ColumnWithNameAndType column; ColumnWithNameAndType column;
column.type = *it; column.type = *it;
column.name = node->getTreeID()/* + "_" + Poco::NumberFormatter::format(res_num)*/; column.name = node->getTreeID() + "_" + Poco::NumberFormatter::format(res_num);
result_numbers.push_back(block.columns()); result_numbers.push_back(block.columns());
block.insert(column); block.insert(column);
@ -163,6 +164,8 @@ void Expression::executeImpl(ASTPtr ast, Block & block)
{ {
if (ASTIdentifier * ident = dynamic_cast<ASTIdentifier *>(&**it)) if (ASTIdentifier * ident = dynamic_cast<ASTIdentifier *>(&**it))
argument_numbers.push_back(block.getPositionByName(ident->name)); argument_numbers.push_back(block.getPositionByName(ident->name));
else if (ASTFunction * func = dynamic_cast<ASTFunction *>(&**it))
argument_numbers.insert(argument_numbers.end(), func->return_column_numbers.begin(), func->return_column_numbers.end());
else else
argument_numbers.push_back(block.getPositionByName((*it)->getTreeID())); argument_numbers.push_back(block.getPositionByName((*it)->getTreeID()));
} }