dtl
// Random access DBView built from a DynamicDBView
void RandomDynamicDBView()
{
DynamicDBView<> dynamic_view("DB_EXAMPLE", "*");
RandomDBView<variant_row, variant_row> random_view(dynamic_view);
cout << "Items from DB:" << endl;
copy(random_view.begin(), random_view.end(), ostream_iterator<variant_row>(cout, "\n"));
cout << "\n\n";
cout << "Items from DB in reverse order:" << endl;
copy(random_view.rbegin(), random_view.rend(), ostream_iterator<variant_row>(cout, "\n"));
// insert and delete rows
variant_row row_insert(random_view[2]);
row_insert["INT_VALUE"] = 666;
random_view.insert(row_insert);
random_view.erase(random_view.begin()+(ptrdiff_t)2);
cout << "Show result set with inserted/deleted row:" << endl;
random_view.ReQuery();
copy(random_view.begin(), random_view.end(), ostream_iterator<variant_row>(cout, "\n"));
}
Copyright © 2002, Michael Gradman and Corwin Joy.
Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appears in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Corwin Joy and Michael Gradman make no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.