43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
#include "category.hh"
|
|
#include "category_impl.hh"
|
|
#include "item.hh"
|
|
#include "item_impl.hh"
|
|
#include "dbsession.hh"
|
|
#include "dbobjectvec.hh"
|
|
|
|
#include <iostream>
|
|
|
|
using namespace inventory;
|
|
using namespace datamodel;
|
|
using namespace inventory::db;
|
|
|
|
int main(int argc, char *argv[]) {
|
|
DBSession session(argv[1]);
|
|
|
|
return 0;
|
|
|
|
std::cout << "Categories' items" << std::endl;
|
|
|
|
DBContainerPtr<Category> cats = Category::get_all(session);
|
|
for (DBObjectPtr<Category> cat : *cats) {
|
|
std::cout << (std::string)(cat->name) << std::endl;
|
|
DBContainerPtr<Item> items = cat->get_objects(session);
|
|
for (DBObjectPtr<Item> it : *items) {
|
|
std::cout << "\t" << (std::string)(it->name) << std::endl;
|
|
}
|
|
}
|
|
|
|
std::cout << "Items' categories" << std::endl;
|
|
|
|
DBContainerPtr<Item> items = Item::get_all(session);
|
|
for (DBObjectPtr<Item> item : *items) {
|
|
std::cout << (std::string)(item->name) << std::endl;
|
|
DBContainerPtr<Category> cats = Category::get_assoc(session, *item);
|
|
for (DBObjectPtr<Category> cat : *cats) {
|
|
std::cout << "\t" << (std::string)(cat->name) << std::endl;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|