NAString NAFileSet::getBestPartitioningKeyColumns(char separator) const { const NAColumnArray & partKeyCols = getPartitioningKeyColumns(); if ( partKeyCols.entries() > 0 ) { return partKeyCols.getColumnNamesAsString(separator); } else { const NAColumnArray& allCols = getAllColumns(); UInt32 ct = allCols.entries(); if ( ct > 2 ) ct=2; return allCols.getColumnNamesAsString(separator, ct); } }
SimpleQueryWidget::SimpleQueryWidget(Database *db, QWidget *parent) : QWidget(parent) { dao = new QueryDAO(db); generator = new QueryGenerator(); getAllTables(); for(auto i = 0; i < tablesList.size(); i++) { getAllColumns(tablesList[i]); } QStringList typesList; typesList.push_back("INSERT"); typesList.push_back("SELECT"); typesList.push_back("UPDATE"); typesList.push_back("DELETE"); //// ///// widgetLayout = new QVBoxLayout; beginLabel = new QLabel("Input data for your Query"); resultLabel = new QLabel("Result of your Query"); equalsLabel = new QLabel(" = "); tableBox = new QComboBox(); columnsBox = new QComboBox(); chosenContent = new QLineEdit(); location = new QLineEdit(); location->setText("FROM"); whereEq1 = new QLineEdit(); whereEq2 = new QLineEdit(); buttonOK = new QPushButton("Make"); buttonExit = new QPushButton("Exit"); queryTypesBox = new QComboBox; queryTypesBox->addItems(typesList); textBrowser = new QTextBrowser; InitTableBox(); widgetLayout->addWidget(beginLabel); widgetLayout->addWidget(queryTypesBox); widgetLayout->addWidget(tableBox); widgetLayout->addWidget(columnsBox); // widgetLayout->addWidget(chosenContent); // widgetLayout->addWidget(location); // widgetLayout->addWidget(whereEq1); // widgetLayout->addWidget(equalsLabel); widgetLayout->addWidget(resultLabel); widgetLayout->addWidget(textBrowser); widgetLayout->addWidget(buttonOK); widgetLayout->addWidget(buttonExit); connect(tableBox, SIGNAL(currentIndexChanged(int)), this, SLOT(loadCB(int))); connect(buttonOK, SIGNAL(clicked()), this, SLOT (MakeQuery())); connect(buttonExit, SIGNAL(clicked()), this, SLOT(close())); setLayout(widgetLayout); }