Author: dmacvicar Date: Fri Jul 27 17:35:30 2007 New Revision: 6266 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6266&view=rev Log: - invert arguments in sqlite3x setprogresshandler - add some docu - try to make clean cache also tick Modified: trunk/libzypp/zypp/RepoManager.cc trunk/libzypp/zypp/cache/CacheStore.cc trunk/libzypp/zypp/cache/sqlite3x/sqlite3x.hpp trunk/libzypp/zypp/cache/sqlite3x/sqlite3x_connection.cpp trunk/libzypp/zypp/repo/cached/RepoImpl.cc Modified: trunk/libzypp/zypp/RepoManager.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.cc?rev=6266&r1=6265&r2=6266&view=diff ============================================================================== --- trunk/libzypp/zypp/RepoManager.cc (original) +++ trunk/libzypp/zypp/RepoManager.cc Fri Jul 27 17:35:30 2007 @@ -604,11 +604,13 @@ 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(); } Modified: trunk/libzypp/zypp/cache/CacheStore.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/CacheStore.cc?rev=6266&r1=6265&r2=6266&view=diff ============================================================================== --- trunk/libzypp/zypp/cache/CacheStore.cc (original) +++ trunk/libzypp/zypp/cache/CacheStore.cc Fri Jul 27 17:35:30 2007 @@ -767,6 +767,7 @@ const ProgressData::ReceiverFnc & progressrcv ) { sqlite3_command cmd( _pimpl->con, "delete from repositories where id=:id"); + _pimpl->con.setprogresshandler(progressrcv); cmd.bind(":id", id); try @@ -775,8 +776,10 @@ } catch ( const sqlite3x::database_error &e ) { + _pimpl->con.resetprogresshandler(); ZYPP_THROW(CacheRecordNotFoundException()); } + _pimpl->con.resetprogresshandler(); } void CacheStore::cleanRepository( const std::string &alias, Modified: trunk/libzypp/zypp/cache/sqlite3x/sqlite3x.hpp URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/sqlite3x/sqlite3x.hpp?rev=6266&r1=6265&r2=6266&view=diff ============================================================================== --- trunk/libzypp/zypp/cache/sqlite3x/sqlite3x.hpp (original) +++ trunk/libzypp/zypp/cache/sqlite3x/sqlite3x.hpp Fri Jul 27 17:35:30 2007 @@ -47,8 +47,17 @@ sqlite3_connection(const char *db); sqlite3_connection(const wchar_t *db); - void setprogresshandler( int, - const zypp::ProgressData::ReceiverFnc & ); + /** + * \short Sets a tick progress callback + * \param fnc callback + * \param n number of sqlite vm opcodes per tick + */ + void setprogresshandler( const zypp::ProgressData::ReceiverFnc &fnc, + int n = 100 ); + /** + * \short Disables tick progress callback + */ + void resetprogresshandler(); ~sqlite3_connection(); Modified: trunk/libzypp/zypp/cache/sqlite3x/sqlite3x_connection.cpp URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/cache/sqlite3x/sqlite3x_connection.cpp?rev=6266&r1=6265&r2=6266&view=diff ============================================================================== --- trunk/libzypp/zypp/cache/sqlite3x/sqlite3x_connection.cpp (original) +++ trunk/libzypp/zypp/cache/sqlite3x/sqlite3x_connection.cpp Fri Jul 27 17:35:30 2007 @@ -73,8 +73,8 @@ if (this->db) sqlite3_close(this->db); } -void sqlite3_connection::setprogresshandler( int n, - const zypp::ProgressData::ReceiverFnc &fnc ) +void sqlite3_connection::setprogresshandler( const zypp::ProgressData::ReceiverFnc &fnc, + int n) { _ticks.sendTo(fnc); if ( fnc ) @@ -83,6 +83,11 @@ sqlite3_progress_handler(db, n, NULL, (void*)this); } +void sqlite3_connection::resetprogresshandler() +{ + sqlite3_progress_handler(db, 0, NULL, (void*)this); +} + void sqlite3_connection::open(const char *db) { if (sqlite3_open(db, &this->db)!=SQLITE_OK) Modified: trunk/libzypp/zypp/repo/cached/RepoImpl.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/cached/RepoImpl.cc?rev=6266&r1=6265&r2=6266&view=diff ============================================================================== --- trunk/libzypp/zypp/repo/cached/RepoImpl.cc (original) +++ trunk/libzypp/zypp/repo/cached/RepoImpl.cc Fri Jul 27 17:35:30 2007 @@ -83,7 +83,7 @@ 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;"); @@ -171,7 +171,7 @@ } } con.executenonquery("COMMIT;"); - con.setprogresshandler(00, ProgressData::ReceiverFnc()); + con.resetprogresshandler(); } catch(exception &ex) { cerr << "Exception Occured: " << ex.what() << endl; @@ -201,7 +201,7 @@ 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;"); @@ -300,7 +300,7 @@ _patchRpms.push_back(patch); } - con.setprogresshandler(0, ProgressData::ReceiverFnc()); + con.resetprogresshandler(); } catch(exception &ex) { cerr << "Exception Occured: " << ex.what() << endl; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org