Esempio n. 1
0
// FIXME: Should remove when the simple_optimizer tears down
//  Initializes the update plan without adding any child nodes and
//  retrieves column ids for the child scan plan.
void UpdatePlan::BuildInitialUpdatePlan(
    const parser::UpdateStatement *parse_tree, std::vector<oid_t> &column_ids) {
  LOG_TRACE("Creating an Update Plan");
  auto t_ref = parse_tree->table;
  auto table_name = std::string(t_ref->GetTableName());
  auto database_name = t_ref->GetDatabaseName();
  LOG_TRACE("Update database %s table %s", database_name, table_name.c_str());
  target_table_ = catalog::Catalog::GetInstance()->GetTableWithName(
      database_name, table_name);
  PL_ASSERT(target_table_ != nullptr);

  for (auto update_clause : *parse_tree->updates) {
    updates_.push_back(update_clause->Copy());
  }
  TargetList tlist;
  DirectMapList dmlist;
  oid_t col_id;
  auto schema = target_table_->GetSchema();

  for (auto update : updates_) {
    // get oid_t of the column and push it to the vector;
    col_id = schema->GetColumnID(std::string(update->column));
    column_ids.push_back(col_id);
    auto *update_expr = update->value->Copy();
    expression::ExpressionUtil::TransformExpression(target_table_->GetSchema(),
                                                    update_expr);

    planner::DerivedAttribute attribute{update_expr};
    attribute.attribute_info.name = update->column;
    tlist.emplace_back(col_id, attribute);
  }

  auto &schema_columns = schema->GetColumns();
  for (uint i = 0; i < schema_columns.size(); i++) {
    bool is_in_target_list = false;
    for (auto col_id : column_ids) {
      if (schema_columns[i].column_name == schema_columns[col_id].column_name) {
        is_in_target_list = true;
        break;
      }
    }
    if (is_in_target_list == false)
      dmlist.emplace_back(i, std::pair<oid_t, oid_t>(0, i));
  }

  std::unique_ptr<const planner::ProjectInfo> project_info(
      new planner::ProjectInfo(std::move(tlist), std::move(dmlist)));
  project_info_ = std::move(project_info);

  if (parse_tree->where != nullptr)
    where_ = parse_tree->where->Copy();
  else
    where_ = nullptr;
  expression::ExpressionUtil::TransformExpression(target_table_->GetSchema(),
                                                  where_);
}
Esempio n. 2
0
void CTimeBarItem::OnMouse(wxMouseEvent& event)
{
    
    CTimeBarItemContainer* pParent = (CTimeBarItemContainer*)GetParent();
    CTimeBarFrame* pFrame = pParent->GetTimeBarFrameWindow();
    wxPoint pstn= event.GetPosition(); 
    int index = PointToCell(pstn);
    int iCellWidth = pParent->GetCellWidth();
    int CursorPosition = pstn.x / iCellWidth;
    CursorPosition *= iCellWidth;
    CursorPosition += iCellWidth * 0.5F;
    if (event.ButtonDown(wxMOUSE_BTN_LEFT))
    {
        pFrame->SetClickOnScalebar(false);
        pParent->GetCurrentSelect().m_iSelectRowBegin = index;
        pParent->GetCurrentSelect().m_iSelectColumnBegin = GetColumnID();
        pParent->GetCurrentSelect().m_iSelectRowEnd = index;
        pParent->GetCurrentSelect().m_iSelectColumnEnd = GetColumnID();
        pFrame->SetCursorPositionX(CursorPosition);
        pFrame->ClickOnScaleBar();
    }
    else if (event.Dragging())
    {   
        if (pstn.x % FREQUENCYREDUCTIONFACTOR == 0)
        {
            if (!pParent->GetTimeBarFrameWindow()->IsClickOnScalebar())
            {
                pParent->GetCurrentSelect().m_iSelectRowEnd = index;
                pParent->GetCurrentSelect().m_iSelectColumnEnd = GetColumnID();
            }
            pFrame->SetCursorPositionX(CursorPosition);
            pFrame->ClickOnScaleBar();
        }
    }
    else if (event.ButtonUp(wxMOUSE_BTN_LEFT))
    {
        int id = GetColumnID();
        pFrame->SetCurrentSelect(id);
    }
    event.Skip();
};
Esempio n. 3
0
// Clears all data associated with cells of one row (string, blob and guid)    
void CValueTable::DeleteRowData(int RowIdx)
{
	for (int ColIdx = 0; ColIdx < GetNumColumns(); ColIdx++)
	{
		const CType* Type = GetColumnID(ColIdx)->GetType();

		if (Type == TString)
			DATA_TYPE_NV(nString)::Delete(GetValuePtr(ColIdx, RowIdx));
		else if (Type == DATA_TYPE(CBuffer))
			DATA_TYPE_NV(CBuffer)::Delete(GetValuePtr(ColIdx, RowIdx));
		else if (!Type)
			((CData*)GetValuePtr(ColIdx, RowIdx))->Clear();
	}
}
SHeaderRow::FColumn::FArguments FActorInfoColumn::ConstructHeaderRowColumn()
{
	if( ModeOptions.Num() == 0 )
	{
		for( auto CurModeIndex = 0; CurModeIndex < ECustomColumnMode::Count; ++CurModeIndex )
		{
			ModeOptions.Add( MakeShareable( new ECustomColumnMode::Type( ( ECustomColumnMode::Type )CurModeIndex ) ) );
		}
	}

	/** Customizable actor data column */
	return SHeaderRow::Column( GetColumnID() )
		.FillWidth(2)
		.HeaderComboVisibility(EHeaderComboVisibility::Ghosted)
		.MenuContent()
		[
			SNew(SBorder)
			.Padding(FMargin(5))
			.BorderImage(FEditorStyle::GetBrush("Menu.Background"))
			[
				SNew(SListView<TSharedPtr<ECustomColumnMode::Type>>)
				.ListItemsSource(&ModeOptions)
				.OnGenerateRow( this, &FActorInfoColumn::MakeComboButtonItemWidget )
				.OnSelectionChanged( this, &FActorInfoColumn::OnModeChanged )
			]
		]
		.HeaderContent()
		[
			SNew( SHorizontalBox )

			+SHorizontalBox::Slot()
			.VAlign(VAlign_Center)
			[
				SNew(STextBlock)
				.Text( this, &FActorInfoColumn::GetSelectedMode )
			]
		];
}
Esempio n. 5
0
CString CSQLDirect::GetCol( CString svName, CString svTable )
{
	return GetCol( GetColumnID( svName,svTable ) );
}