void SQLToolWidget::showObjectData(QTreeWidgetItem *item) { try { QString cmd; ResultSet res; cmd=QString("SELECT * FROM %1.%2;") .arg(BaseObject::formatName(item->data(DatabaseImportForm::OBJECT_SCHEMA, Qt::UserRole).toString())) .arg(BaseObject::formatName(item->text(0))); registerSQLCommand(sql_cmd_txt->toPlainText()); sql_cmd_txt->setText(cmd); sql_cmd_conn.executeDMLCommand(cmd, res); results_parent->setVisible(true); msgoutput_lst->setVisible(false); fillResultsTable(res); } catch(Exception &e) { showError(e); } }
void SQLToolWidget::runSQLCommand(void) { try { ResultSet res; QString cmd=sql_cmd_txt->textCursor().selectedText(); if(cmd.isEmpty()) cmd=sql_cmd_txt->toPlainText(); sql_cmd_conn.executeDMLCommand(cmd, res); registerSQLCommand(cmd); results_parent->setVisible(!res.isEmpty()); export_tb->setEnabled(!res.isEmpty()); msgoutput_lst->setVisible(res.isEmpty()); if(results_tbw->isVisible()) fillResultsTable(res); else { QLabel *label=new QLabel(trUtf8("SQL command successfully executed. <em>Rows affected <strong>%1</strong></em>").arg(res.getTupleCount())); QListWidgetItem *item=new QListWidgetItem; item->setIcon(QIcon(":/icones/icones/msgbox_info.png")); msgoutput_lst->clear(); msgoutput_lst->addItem(item); msgoutput_lst->setItemWidget(item, label); } } catch(Exception &e) { showError(e); } }
void SQLExecutionWidget::fillResultsTable(ResultSet &res) { try { Catalog catalog; Connection aux_conn=sql_cmd_conn; row_cnt_lbl->setText(QString::number(res.getTupleCount())); export_tb->setEnabled(res.getTupleCount() > 0); catalog.setConnection(aux_conn); fillResultsTable(catalog, res, results_tbw); } catch(Exception &e) { throw Exception(e.getErrorMessage(), e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }
void isiTapResults::customEvent(QCustomEvent *event) { prcInfo *pinfo; switch (event->type()) { case STOP: fillResultsTable(); bExitPossible = TRUE; PushButtonCANCEL->show(); PushButtonOK->show(); break; case LOG: pinfo = (prcInfo *)event->data(); outputLog->setText(pinfo->sInfo); progressBar1->setProgress(pinfo->percent); break; default: qWarning("Unknown custom event type: %d", event->type()); } }