#include "zypp/ZYppFactory.h"
#include "zypp/ZYpp.h"
#include "zypp/ZConfig.h"
-
+#include "zypp/Package.h"
#include "zypp/cache/CacheInitializer.h"
#include "zypp/cache/CacheStore.h"
#include "zypp/cache/CacheException.h"
appendStringAttribute( resolvable_id, klass, name, value );
}
+template
+void CacheStore::appendStringContainerAttribute( const data::RecordId &resolvable_id,
+ const std::string &klass,
+ const std::string &name,
+ const std::set<std::string> &cont );
+template
+void CacheStore::appendStringContainerAttribute( const data::RecordId &resolvable_id,
+ const std::string &klass,
+ const std::string &name,
+ const std::list<std::string> &cont );
+template
+ void CacheStore::appendStringContainerAttribute( const data::RecordId &resolvable_id,
+ const std::string &klass,
+ const std::string &name,
+ const Package::Keywords &cont );
+
+
+
}
}
#include "zypp/cache/CacheTypes.h"
#include "zypp/cache/ResolvableQuery.h"
+#include "zypp/Package.h"
#include "zypp/cache/sqlite3x/sqlite3x.hpp"
using namespace sqlite3x;
{
}
-
data::ResObject_Ptr fromRow( sqlite3_reader &reader )
{
data::ResObject_Ptr ptr (new data::ResObject);
string all = queryStringAttributeInternal( con, record_id, klass, name);
_Container words;
- str::split( all, std::back_inserter(words) );
+ //
+ //str::split( all, std::inserter(words) );
return words;
}
}
};
+template
+list<string> ResolvableQuery::Impl::queryStringContainerAttribute( const data::RecordId &record_id,
+ const std::string &klass,
+ const std::string &name );
+
+template
+set<string> ResolvableQuery::Impl::queryStringContainerAttribute( const data::RecordId &record_id,
+ const std::string &klass,
+ const std::string &name );
+
//////////////////////////////////////////////////////////////////////////////
// FORWARD TO IMPLEMENTATION
//////////////////////////////////////////////////////////////////////////////
return _pimpl->queryTranslatedStringAttribute(record_id, klass, name);
}
+template<class _Container>
+_Container ResolvableQuery::queryStringContainerAttribute( const data::RecordId &record_id,
+ const std::string &klass,
+ const std::string &name )
+{
+ return _pimpl->queryStringContainerAttribute<_Container>(record_id, klass, name);
+}
+
+template
+std::set<std::string> ResolvableQuery::queryStringContainerAttribute( const data::RecordId &record_id,
+ const std::string &klass,
+ const std::string &name );
+
+template
+std::list<std::string> ResolvableQuery::queryStringContainerAttribute( const data::RecordId &record_id,
+ const std::string &klass,
+ const std::string &name );
+
+template
+Package::Keywords ResolvableQuery::queryStringContainerAttribute( const data::RecordId &record_id,
+ const std::string &klass,
+ const std::string &name );
+
//////////////////////////////////////////////////////////////////////////////
} } // namespace zypp::cache
#ifndef ZYPP_CACHE_RESOLVABLE_QUERY_H
#define ZYPP_CACHE_RESOLVABLE_QUERY_H
+#include <set>
+#include <list>
#include "zypp/base/Function.h"
#include "zypp/Pathname.h"
#include "zypp/data/ResolvableData.h"
/** Pointer to implementation. */
RW_pointer<Impl> _pimpl;
};
-
} //NS cache
} //NS zypp
sqlite3_command cmd( con, "select id,name,version,release,epoch,arch,kind from resolvables where repository_id=:repository_id;");
cmd.bind(":repository_id", _repository_id);
- map<data::RecordId, NVRAD> nvras;
+ map<data::RecordId, pair<Resolvable::Kind, NVRAD> > nvras;
sqlite3_reader reader = cmd.executereader();
while(reader.read())
{
long long id = reader.getint64(0);
Dependencies deps;
-
+ Resolvable::Kind kind = _type_cache.kindFor(reader.getint(6));
// Collect basic Resolvable data
- nvras[id] = NVRAD( reader.getstring(1),
- Edition( reader.getstring(2), reader.getstring(3), reader.getint(4) ),
- _type_cache.archFor(reader.getint(5)),
- deps
- );
+ nvras[id] = make_pair( kind, NVRAD( reader.getstring(1),
+ Edition( reader.getstring(2), reader.getstring(3), reader.getint(4) ),
+ _type_cache.archFor(reader.getint(5)),
+ deps ) );
}
MIL << "Done reading resolvables nvra" << endl;
read_capabilities( con, nvras);
- for ( map<data::RecordId, NVRAD>::const_iterator it = nvras.begin(); it != nvras.end(); ++it )
+ for ( map<data::RecordId, pair<Resolvable::Kind, NVRAD> >::const_iterator it = nvras.begin(); it != nvras.end(); ++it )
{
- ResImplTraits<cached::PackageImpl>::Ptr impl = new cached::PackageImpl(it->first, this);
- Package::Ptr package = detail::makeResolvableFromImpl( it->second, impl );
- _store.insert (package);
+ if ( it->second.first == ResTraits<Package>::kind )
+ {
+ ResImplTraits<cached::PackageImpl>::Ptr impl = new cached::PackageImpl(it->first, this);
+ Package::Ptr package = detail::makeResolvableFromImpl( it->second.second, impl );
+ _store.insert (package);
+ }
}
con.executenonquery("COMMIT;");
}
return _rquery;
}
-void RepoImpl::read_capabilities( sqlite3_connection &con, map<data::RecordId, NVRAD> &nvras )
+void RepoImpl::read_capabilities( sqlite3_connection &con, map<data::RecordId, pair<Resolvable::Kind, NVRAD> > &nvras )
{
CapFactory capfactory;
{
capability::NamedCap *ncap = new capability::NamedCap( refer, reader.getstring(1) );
zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(6));
- nvras[rid][deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(ncap) ) );
+ nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(ncap) ) );
}
else
{
capability::VersionedCap *vcap = new capability::VersionedCap( refer, reader.getstring(1), /* rel */ rel, Edition( reader.getstring(2), reader.getstring(3), reader.getint(4) ) );
zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(6));
- nvras[rid][deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(vcap) ) );
+ nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(vcap) ) );
}
}
}
capability::FileCap *fcap = new capability::FileCap( refer, reader.getstring(1) + "/" + reader.getstring(2) );
zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(3));
data::RecordId rid = reader.getint64(4);
- nvras[rid][deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(fcap) ) );
+ nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(fcap) ) );
}
}
#include <iosfwd>
#include <map>
+#include <utility>
#include "zypp/Arch.h"
#include "zypp/Rel.h"
#include "zypp/Pathname.h"
void createResolvables();
protected:
- void read_capabilities( sqlite3x::sqlite3_connection &con, std::map<data::RecordId, NVRAD> &nvras );
+ void read_capabilities( sqlite3x::sqlite3_connection &con, std::map<data::RecordId, std::pair<Resolvable::Kind, NVRAD> > &nvras );
Pathname _dbdir;
cache::CacheTypes _type_cache;
data::RecordId _repository_id;