void OperatorClassWidget::setAttributes(DatabaseModel *model, OperationList *op_list, Schema *schema, OperatorClass *op_class) { PgSQLType type; unsigned i, count; BaseObjectWidget::setAttributes(model, op_list, op_class, schema); family_sel->setModel(model); function_sel->setModel(model); operator_sel->setModel(model); elem_family_sel->setModel(model); storage_type->setAttributes(type, model); if(op_class) { type=op_class->getDataType(); family_sel->setSelectedObject(op_class->getFamily()); def_class_chk->setChecked(op_class->isDefault()); indexing_cmb->setCurrentIndex(indexing_cmb->findText(~(op_class->getIndexingType()))); elements_tab->blockSignals(true); count=op_class->getElementCount(); for(i=0; i < count; i++) { elements_tab->addRow(); showElementData(op_class->getElement(i), i); } elements_tab->blockSignals(false); elements_tab->clearSelection(); } data_type->setAttributes(type, model); }
void IndexWidget::handleElement(int elem_idx) { if(column_rb->isChecked() || (expression_rb->isChecked() && !elem_expr_txt->toPlainText().isEmpty())) { IndexElement elem; elem.setSortingEnabled(sorting_chk->isChecked()); elem.setSortingAttribute(IndexElement::NULLS_FIRST, nulls_first_chk->isChecked()); elem.setSortingAttribute(IndexElement::ASC_ORDER, ascending_rb->isChecked()); elem.setOperatorClass(dynamic_cast<OperatorClass *>(op_class_sel->getSelectedObject())); if(expression_rb->isChecked()) elem.setExpression(elem_expr_txt->toPlainText().toUtf8()); else elem.setColumn(reinterpret_cast<Column *>(column_cmb->itemData(column_cmb->currentIndex()).value<void *>())); showElementData(elem, elem_idx); elem_expr_txt->clear(); ascending_rb->setChecked(true); sorting_chk->setChecked(true); op_class_sel->clearSelector(); nulls_first_chk->setChecked(false); } else if(elements_tab->getCellText(elem_idx,0).isEmpty()) elements_tab->removeRow(elem_idx); }
void OperatorClassWidget::handleElement(int lin_idx) { OperatorClassElement elem; unsigned elem_type; elem_type=elem_type_cmb->currentIndex(); try { if(elem_type==OperatorClassElement::FUNCTION_ELEM) elem.setFunction(dynamic_cast<Function *>(function_sel->getSelectedObject()), stg_num_sb->value()); else if(elem_type==OperatorClassElement::OPERATOR_ELEM) { elem.setOperator(dynamic_cast<Operator *>(operator_sel->getSelectedObject()), stg_num_sb->value()); elem.setOperatorFamily(dynamic_cast<OperatorFamily *>(elem_family_sel->getSelectedObject())); } else elem.setStorage(storage_type->getPgSQLType()); showElementData(elem, lin_idx); function_sel->clearSelector(); operator_sel->clearSelector(); stg_num_sb->setValue(1); elements_tab->clearSelection(); } catch(Exception &e) { //In case of error removes the recently added table line if(elements_tab->getCellText(lin_idx, 0).isEmpty()) elements_tab->removeRow(lin_idx); throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }
void IndexWidget::setAttributes(DatabaseModel *model, Table *parent_obj, OperationList *op_list, Index *index) { unsigned i, count; if(!parent_obj) throw Exception(ERR_ASG_NOT_ALOC_OBJECT,__PRETTY_FUNCTION__,__FILE__,__LINE__); BaseObjectWidget::setAttributes(model, op_list, index, parent_obj); op_class_sel->setModel(model); updateColumnsCombo(); if(index) { indexing_cmb->setCurrentIndex(indexing_cmb->findText(~index->getIndexingType())); fill_factor_chk->setChecked(index->getFillFactor() >= 10); if(fill_factor_chk->isChecked()) fill_factor_sb->setValue(index->getFillFactor()); else fill_factor_sb->setValue(90); concurrent_chk->setChecked(index->getIndexAttribute(Index::CONCURRENT)); fast_update_chk->setChecked(index->getIndexAttribute(Index::FAST_UPDATE)); unique_chk->setChecked(index->getIndexAttribute(Index::UNIQUE)); cond_expr_txt->setPlainText(Utf8String::create(index->getConditionalExpression())); elements_tab->blockSignals(true); count=index->getElementCount(); for(i=0; i < count; i++) { elements_tab->addRow(); showElementData(index->getElement(i), i); } elements_tab->blockSignals(false); selectIndexingType(); } }