Permalink
Browse files

LackMan: RemoveLocation in Storage.

  • Loading branch information...
1 parent 5dbece1 commit 95dc461b9a28046b2b81d479eec061e788672447 @0xd34df00d committed Apr 11, 2012
Showing with 17 additions and 3 deletions.
  1. +15 −2 src/plugins/lackman/storage.cpp
  2. +2 −1 src/plugins/lackman/storage.h
@@ -1016,6 +1016,19 @@ namespace LackMan
QueryAddLocation_.finish ();
}
+ void Storage::RemoveLocation (int packageId, int componentId)
+ {
+ QueryRemovePackageFromLocation_.bindValue (":package_id", packageId);
+ QueryRemovePackageFromLocation_.bindValue (":component_id", componentId);
+ if (!QueryRemovePackageFromLocation_.exec ())
+ {
+ Util::DBLock::DumpError (QueryRemovePackageFromLocation_);
+ throw std::runtime_error ("Query execution failed");
+ }
+
+ QueryRemovePackageFromLocation_.finish ();
+ }
+
void Storage::AddToInstalled (int packageId)
{
QueryAddToInstalled_.bindValue (":package_id", packageId);
@@ -1149,8 +1162,8 @@ namespace LackMan
QueryAddLocation_.prepare ("INSERT INTO locations (package_id, component_id) "
"VALUES (:package_id, :component_id);");
- QueryRemovePackageFromLocations_ = QSqlQuery (DB_);
- QueryRemovePackageFromLocations_.prepare ("DELETE FROM locations WHERE package_id = :package_id;");
+ QueryRemovePackageFromLocation_ = QSqlQuery (DB_);
+ QueryRemovePackageFromLocation_.prepare ("DELETE FROM locations WHERE package_id = :package_id AND component_id = :component_id;");
QueryClearTags_ = QSqlQuery (DB_);
QueryClearTags_.prepare ("DELETE FROM tags WHERE name = :name;");
@@ -59,7 +59,7 @@ namespace LackMan
QSqlQuery QueryRemovePackageArchiver_;
QSqlQuery QueryHasLocation_;
QSqlQuery QueryAddLocation_;
- QSqlQuery QueryRemovePackageFromLocations_;
+ QSqlQuery QueryRemovePackageFromLocation_;
QSqlQuery QueryClearTags_;
QSqlQuery QueryAddTag_;
QSqlQuery QueryClearPackageInfos_;
@@ -117,6 +117,7 @@ namespace LackMan
bool HasLocation (int packageId, int componentId);
void AddLocation (int packageId, int componentId);
+ void RemoveLocation (int packageId, int componentId);
void AddToInstalled (int);
void RemoveFromInstalled (int);

0 comments on commit 95dc461

Please sign in to comment.