//Simple use of cb_ptr_fun_w_ret() as a SelVal



// a typical SelVal function that we want to use in DTL
// an Example object is valid if all columns have a value
bool ExampleSelValidate(boundIOs &boundIOs, Example &rowbuf)
{
	for (BoundIOs::iterator b_it = boundIOs.begin();
				b_it != boundIOs.end(); b_it++)
	{
		BoundIO &boundIO = (*b_it).second;
		if (boundIO.IsColumn() && boundIO.IsNull())
			return false;  // found null column ... data is invalid
	}

	return true;	// no nulls found ... data is OK
}

// 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_w_ret() wraps ExampleSelValidate in a function object
 // so DTL may use it as the SelVal for the DBView
 DBView<Example> view("DB_EXAMPLE", DefaultBCA<Example>(),
	"", DefaultBPA<Example>(), cb_ptr_fun_w_ret(ExampleSelValidate));

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

 return results;
}