From: <ibr...@us...> - 2012-06-01 17:08:06
|
Revision: 4331 http://tora.svn.sourceforge.net/tora/?rev=4331&view=rev Author: ibre5041 Date: 2012-06-01 17:07:59 +0000 (Fri, 01 Jun 2012) Log Message: ----------- use cache when changing the schema Modified Paths: -------------- branches/tora-trotl/src/tobrowser.cpp branches/tora-trotl/src/tobrowser.h Modified: branches/tora-trotl/src/tobrowser.cpp =================================================================== --- branches/tora-trotl/src/tobrowser.cpp 2012-06-01 17:06:42 UTC (rev 4330) +++ branches/tora-trotl/src/tobrowser.cpp 2012-06-01 17:07:59 UTC (rev 4331) @@ -1306,7 +1306,7 @@ this, SLOT(mainTab_currentChanged(int))); } -void toBrowser::mainTab_currentChanged(int /*ix*/, bool force_requery) +void toBrowser::mainTab_currentChanged(int /*ix*/, Caching caching) // caching = USE_CACHE is the default { if (Schema->selected().isEmpty()) return; @@ -1322,7 +1322,7 @@ if (m_objectsMap.contains(ix)) { - if (force_requery) + if (caching == NO_USE_CACHE) m_objectsMap[ix]->forceRequery(); m_objectsMap[ix]->changeParams(schema(), Filter ? Filter->wildCard() : "%"); changeItem(); @@ -1412,23 +1412,28 @@ #endif } -void toBrowser::changeSchema(int) -{ - refresh(); -} - toBrowser::~toBrowser() { if (Filter) delete Filter; } +void toBrowser::changeSchema(int) +{ + try + { + Schema->refresh(); + mainTab_currentChanged(m_mainTab->currentIndex(), USE_CACHE); // just a test do now requery the DB // true); + } + TOCATCH +} + void toBrowser::refresh(void) { try { Schema->refresh(); - mainTab_currentChanged(m_mainTab->currentIndex(), true); + mainTab_currentChanged(m_mainTab->currentIndex(), NO_USE_CACHE); // just a test do now requery the DB // true); } TOCATCH } Modified: branches/tora-trotl/src/tobrowser.h =================================================================== --- branches/tora-trotl/src/tobrowser.h 2012-06-01 17:06:42 UTC (rev 4330) +++ branches/tora-trotl/src/tobrowser.h 2012-06-01 17:07:59 UTC (rev 4331) @@ -114,6 +114,11 @@ { Q_OBJECT; + enum Caching { + USE_CACHE = 0, + NO_USE_CACHE + }; + toResultCombo *Schema; QTabWidget *m_mainTab; QMenu *ToolMenu; @@ -262,9 +267,9 @@ private slots: /** Handle main tabwidget and its tabs switch * @param int Tab which has been activated - * @param force_requery Do not try using the cache but query the database instead + * @param Caching caching Do(not) try using the cache but query the database instead */ - void mainTab_currentChanged(int, bool force_requery = false); + void mainTab_currentChanged(int, Caching caching = USE_CACHE); protected: virtual void closeEvent(QCloseEvent *); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |