#include <iostream>
#include "ocilib.hpp"
void print_product(
const Object &product)
 {
    std::cout << 
"...product: " << product.
Get<
int>(
"code") << 
" - " << product.
Get<
ostring>(
"name") << std::endl;
}
{
    std::cout << "fetch using iterators" << std::endl;
    for (; it1 != it2; ++it1)
    {
        print_product(static_cast<Object>(*it1));
    }
}
{
    std::cout << "fetch using index access" << std::endl;
    unsigned int i = 1, n = coll.
GetCount();
     for (; i <= n; i++)
    {
        print_product(static_cast<Object>(coll[i]));
    }
}
{
    std::cout << "fetch using const iterators" << std::endl;
    for (; it1 != it2; ++it1)
    {
        print_product(static_cast<Object>(*it1));
    }
}
{
    std::cout << "fetch using const index access" << std::endl;
    unsigned int i = 1, n = coll.
GetCount();
     for (; i <=n ; i++)
    {
        print_product(static_cast<Object>(coll[i]));
    }
}
{
    st.Prepare("begin :array := product_varray_t(product_t(123, 'name 123'), product_t(456, 'name 456'), product_t(789, 'name 789')); end;");
    st.ExecutePrepared();
    print_coll_by_iterator(coll);
    print_coll_by_index(coll);
}
template <class T>
{
    st.Execute("select * from " + table_name);
    while (rs++)
    {
        std::cout << 
"#" << rs.
Get<
ostring>(1) << std::endl;
    }
}
int main(void)
{
    try
    {
        bind_coll(con);
        fetch_coll(con, "products_varray", print_const_coll_by_iterator);
        fetch_coll(con, "products_nested_table", print_const_coll_by_index);
    }
    catch (std::exception &ex)
    {
        std::cout << ex.what() << std::endl;
    }
    return EXIT_SUCCESS;
}