//Simple use of cb_ptr_fun() with a BCA


// a BCA written as a simple function 
void BCAExample(BoundIOs &cols, Example &row)
{
  cols["INT_VALUE"]    == row.exampleInt;
  cols["STRING_VALUE"] == row.exampleStr;
  cols["DOUBLE_VALUE"] == row.exampleDouble;
  cols["EXAMPLE_LONG"] == row.exampleLong;
  cols["EXAMPLE_DATE"] == row.exampleDate;
}

// Read the contents of the DB_EXAMPLE table and return a vector of the
// resulting rows
vector<Example> ReadData()
{
 vector<Example> results;

 // the call to cb_ptr_fun() wraps BCAExample in a function object
 // so DTL may use it as the BCA for the DBView
 DBView<Example> view("DB_EXAMPLE", cb_ptr_fun(BCAExample));

 DBView<Example>::select_iterator read_it = view.begin();
 for ( ; read_it != view.end(); ++read_it)
 {
  results.push_back(*read_it);
 }

 return results;
}