40 lines
865 B
C++
40 lines
865 B
C++
#include "dbobjectptr.hh"
|
|
#include "dbobjectvec.hh"
|
|
#include "dbcontainer.hh"
|
|
#include "item.hh"
|
|
#include "item_impl.hh"
|
|
#include "dbsession.hh"
|
|
|
|
#include <iostream>
|
|
|
|
using namespace inventory;
|
|
using namespace datamodel;
|
|
using namespace inventory::db;
|
|
using namespace std;
|
|
|
|
int main(int argc, char *argv[]) {
|
|
DBSession session(argv[1]);
|
|
|
|
return 0;
|
|
|
|
std::cout << "Items via vector: " << std::endl;
|
|
{
|
|
DBContainerPtr<Item> items = Item::get_all(session);
|
|
for (DBObjectPtr<Item> &it : *items) {
|
|
cout << it->name.c_str() << endl;
|
|
}
|
|
}
|
|
|
|
std::cout << "Items via map: " << std::endl;
|
|
{
|
|
DBContainerPtr<Item, DBObjectMap> items
|
|
= Item::get_all<DBObjectMap>(session);
|
|
for (auto &map_pair : *items) {
|
|
DBObjectPtr<Item> it = map_pair.second;
|
|
cout << it->name.c_str() << endl;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|