callback::SendReport<ProgressReport> report;
progress.sendTo( ProgressReportAdaptor( progressrcv, report ) );
progress.name(str::form(_("Cleaning repository '%s' cache"), info.alias().c_str()));
- progress.toMin();
-
+
cache::CacheStore store(_pimpl->options.repoCachePath);
data::RecordId id = store.lookupRepository(info.alias());
+
+ CombinedProgressData subprogrcv(progress);
+
store.cleanRepository(id);
store.commit();
}
const ProgressData::ReceiverFnc & progressrcv )
{
sqlite3_command cmd( _pimpl->con, "delete from repositories where id=:id");
+ _pimpl->con.setprogresshandler(progressrcv);
cmd.bind(":id", id);
try
}
catch ( const sqlite3x::database_error &e )
{
+ _pimpl->con.resetprogresshandler();
ZYPP_THROW(CacheRecordNotFoundException());
}
+ _pimpl->con.resetprogresshandler();
}
void CacheStore::cleanRepository( const std::string &alias,
sqlite3_connection(const char *db);\r
sqlite3_connection(const wchar_t *db);\r
\r
- void setprogresshandler( int,\r
- const zypp::ProgressData::ReceiverFnc & );\r
+ /**\r
+ * \short Sets a tick progress callback\r
+ * \param fnc callback\r
+ * \param n number of sqlite vm opcodes per tick\r
+ */\r
+ void setprogresshandler( const zypp::ProgressData::ReceiverFnc &fnc,\r
+ int n = 100 );\r
+ /**\r
+ * \short Disables tick progress callback\r
+ */\r
+ void resetprogresshandler();\r
\r
~sqlite3_connection();\r
\r
if (this->db) sqlite3_close(this->db);\r
}\r
\r
-void sqlite3_connection::setprogresshandler( int n,\r
- const zypp::ProgressData::ReceiverFnc &fnc )\r
+void sqlite3_connection::setprogresshandler( const zypp::ProgressData::ReceiverFnc &fnc,\r
+ int n)\r
{\r
_ticks.sendTo(fnc);\r
if ( fnc )\r
sqlite3_progress_handler(db, n, NULL, (void*)this);\r
}\r
\r
+void sqlite3_connection::resetprogresshandler()\r
+{\r
+ sqlite3_progress_handler(db, 0, NULL, (void*)this);\r
+}\r
+\r
void sqlite3_connection::open(const char *db)\r
{\r
if (sqlite3_open(db, &this->db)!=SQLITE_OK)\r
try
{
sqlite3_connection con((_options.dbdir + "zypp.db").asString().c_str());
- con.setprogresshandler(100, subprogrcv);
+ con.setprogresshandler(subprogrcv, 100);
con.executenonquery("PRAGMA cache_size=8000;");
con.executenonquery("BEGIN;");
}
}
con.executenonquery("COMMIT;");
- con.setprogresshandler(00, ProgressData::ReceiverFnc());
+ con.resetprogresshandler();
}
catch(exception &ex) {
cerr << "Exception Occured: " << ex.what() << endl;
try
{
sqlite3_connection con((_options.dbdir + "zypp.db").asString().c_str());
- //con.setprogresshandler(500, global_progress_handler, (void*)this);
+ con.setprogresshandler(subprogrcv);
con.executenonquery("PRAGMA cache_size=8000;");
con.executenonquery("BEGIN;");
_patchRpms.push_back(patch);
}
- con.setprogresshandler(0, ProgressData::ReceiverFnc());
+ con.resetprogresshandler();
}
catch(exception &ex) {
cerr << "Exception Occured: " << ex.what() << endl;