void SQLToolWidget::connectToServer(void) { try { if(connections_cmb->currentIndex()==connections_cmb->count()-1 && ConnectionsConfigWidget::openConnectionsConfiguration(connections_cmb, true)) { emit s_connectionsUpdateRequest(); } else { Connection *conn=reinterpret_cast<Connection *>(connections_cmb->itemData(connections_cmb->currentIndex()).value<void *>()); database_cmb->clear(); if(conn) { import_helper.setConnection(*conn); DatabaseImportForm::listDatabases(import_helper, database_cmb); import_helper.closeConnection(); if(sender()==connections_cmb && conn->isAutoBrowseDB()) { database_cmb->setCurrentText(conn->getConnectionParam(Connection::PARAM_DB_NAME)); browseDatabase(); } } database_cmb->setEnabled(database_cmb->count() > 1); refresh_tb->setEnabled(database_cmb->isEnabled()); } } catch(Exception &e) { throw Exception(e.getErrorMessage(), e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }
void DatabaseImportForm::listDatabases(void) { try { //Close a previous connection opened by the import helper import_helper->closeConnection(); if(connections_cmb->currentIndex()==connections_cmb->count()-1 && ConnectionsConfigWidget::openConnectionsConfiguration(connections_cmb, true)) { emit s_connectionsUpdateRequest(); } else { Connection *conn=reinterpret_cast<Connection *>(connections_cmb->itemData(connections_cmb->currentIndex()).value<void *>()); if(conn) { //List the available databases using the selected connection import_helper->setConnection(*conn); DatabaseImportForm::listDatabases(*import_helper, database_cmb); } else database_cmb->clear(); db_objects_tw->clear(); database_cmb->setEnabled(database_cmb->count() > 1); } } catch(Exception &e) { db_objects_tw->clear(); database_cmb->clear(); database_cmb->setEnabled(false); throw Exception(e.getErrorMessage(), e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }