From: Ivan B. <ibr...@us...> - 2005-02-26 18:59:19
|
Update of /cvsroot/tora/tora In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23919 Modified Files: tobrowser.cpp tobrowser.h Log Message: Initial support for database links. Commented out for the monent. Index: tobrowser.cpp =================================================================== RCS file: /cvsroot/tora/tora/tobrowser.cpp,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -d -r1.135 -r1.136 *** tobrowser.cpp 23 Feb 2005 23:47:13 -0000 1.135 --- tobrowser.cpp 26 Feb 2005 18:59:10 -0000 1.136 *************** *** 974,977 **** --- 974,998 ---- " WHERE Trigger_Owner = :f1<char[101]> AND Trigger_Name = :f2<char[101]>", "Columns used by trigger"); + #if DBLINK + static toSQL SQLListDBLink("toBrowser:ListDBLink", + "SELECT Db_Link, Owner FROM SYS.ALL_DB_LINKS\n" + " WHERE (Owner = :f1<char[101]> or Owner='PUBLIC') and\n" + " UPPER(DB_Link) like :f2<char[101]>", + "List database links"); + static toSQL SQLListDBLinkDBA("toBrowser:ListDBLinkDBA", + "SELECT Owner, Db_Link, Username, Host, Created\n" + " FROM SYS.DBA_DB_LINK\n", + "List database links as DBA"); + static toSQL SQLDBLinkInfo("toBrowser:DBLinkInformation", + "SELECT * FROM Sys.all_db_links a\n" + " WHERE Owner = :f1<char[101]>\n" + " AND DB_LINK = :f2<char[101]>", + "Display information about database link"); + static toSQL SQLDBLinkSynonyms("toBrowser:DBLinkSynonyms", + "SELECT * FROM Sys.all_synonyms a\n" + " WHERE Owner = :f1<char[101]>\n" + " AND DB_LINK = :f2<char[101]>", + "Display foreign synonyms"); + #endif static toSQL SQLMySQLAccess("toBrowser:MySQLAcess", *************** *** 1269,1273 **** connect(resultView,SIGNAL(selectionChanged()), this,SLOT(changeItem())); ! connect(resultView,SIGNAL(displayMenu(QPopupMenu *)),this,SLOT(displayIndexMenu(QPopupMenu *))); box->resize(FIRST_WIDTH,resultView->height()); --- 1290,1294 ---- connect(resultView,SIGNAL(selectionChanged()), this,SLOT(changeItem())); ! connect(resultView,SIGNAL(displayMenu(QPopupMenu *)),this,SLOT(displayIndexMenu(QPopupMenu *))); box->resize(FIRST_WIDTH,resultView->height()); *************** *** 1445,1449 **** SecondMap[TAB_TRIGGER_COLS]=resultView; - resultView=new toResultLong(true,false,toQuery::Background,curr,TAB_TRIGGER_GRANTS); resultView->setSQL(SQLAnyGrants); --- 1466,1469 ---- *************** *** 1461,1465 **** --- 1481,1528 ---- connect(curr,SIGNAL(currentChanged(QWidget *)),this,SLOT(changeSecondTab(QWidget *))); + + #ifdef DBLINK + splitter=new QSplitter(Horizontal,TopTab,TAB_DBLINK); + TopTab->addTab(splitter,tr("DBLinks")); + box=new QVBox(splitter); + toolbar=toAllocBar(box,tr("Database browser")); + new toBrowseButton(QPixmap((const char **)modconstraint_xpm), + tr("Test DBLink"), + tr("Test DBLink"), + this,SLOT(testDBLink()), + toolbar); + toolbar->addSeparator(); + toolbar->setStretchableWidget(new QLabel(toolbar,TO_KDE_TOOLBAR_WIDGET)); + resultView=new toResultLong(true,false,toQuery::Background,box); + resultView->setReadAll(true); + connect(resultView,SIGNAL(done()),this,SLOT(firstDone())); + Map[TAB_DBLINK]=resultView; + resultView->setTabWidget(TopTab); + resultView->setSQL(SQLListDBLink); + resultView->resize(FIRST_WIDTH,resultView->height()); + resultView->setResizeMode(QListView::AllColumns); + connect(resultView,SIGNAL(selectionChanged()), + this,SLOT(changeItem())); + connect(resultView,SIGNAL(displayMenu(QPopupMenu *)),this,SLOT(displayIndexMenu(QPopupMenu *))); + box->resize(FIRST_WIDTH,resultView->height()); + splitter->setResizeMode(box,QSplitter::KeepSize); + curr=new toTabWidget(splitter); + splitter->setResizeMode(curr,QSplitter::Stretch); + + toResultItem *resultDBLink=new toResultItem(2,true,curr,TAB_DBLINK_INFO); + resultDBLink->setSQL(SQLDBLinkInfo); + curr->addTab(resultDBLink,tr("Info")); + SecondMap[TAB_DBLINK]=resultDBLink; + SecondMap[TAB_DBLINK_INFO]=resultDBLink; + + resultView=new toResultLong(true,false,toQuery::Background,curr,TAB_DBLINK_SYNONYMS); + resultView->setSQL(SQLDBLinkSynonyms); + curr->addTab(resultView,tr("&Synonyms")); + SecondMap[TAB_DBLINK_SYNONYMS]=resultView; + + connect(curr,SIGNAL(currentChanged(QWidget *)),this,SLOT(changeSecondTab(QWidget *))); + #endif + splitter=new QSplitter(Horizontal,TopTab,TAB_ACCESS); TopTab->addTab(splitter,tr("Access")); *************** *** 1526,1530 **** connect(curr,SIGNAL(currentChanged(QWidget *)),this,SLOT(changeSecondTab(QWidget *))); ! ToolMenu=NULL; connect(toMainWidget()->workspace(),SIGNAL(windowActivated(QWidget *)), --- 1589,1593 ---- connect(curr,SIGNAL(currentChanged(QWidget *)),this,SLOT(changeSecondTab(QWidget *))); ! ToolMenu=NULL; connect(toMainWidget()->workspace(),SIGNAL(windowActivated(QWidget *)), *************** *** 2693,2694 **** --- 2756,2772 ---- enableDisableConstraints("DISABLE"); } + + void toBrowser::testDBLink(void) + { + if(SecondText.isEmpty()) return; + toQList resultset; + try { + resultset=toQuery::readQueryNull(toCurrentConnection(this), + "SELECT * FROM dual@"+SecondText); + } TOCATCH; + // } catch (...) { + // TOMessageBox::information(this, "Database link", SecondText); + // } + if(!resultset.empty()) + TOMessageBox::information(this, "Database link", SecondText); + } Index: tobrowser.h =================================================================== RCS file: /cvsroot/tora/tora/tobrowser.h,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** tobrowser.h 25 Feb 2005 03:20:05 -0000 1.46 --- tobrowser.h 26 Feb 2005 18:59:10 -0000 1.47 *************** *** 138,141 **** --- 138,143 ---- void disableConstraints(void); + void testDBLink(void); + void displayIndexMenu(QPopupMenu *menu); void displayTableMenu(QPopupMenu *menu); |