Example: A count query using a stored procedure. This illustrates the use of input and output parameters.

class EmptyDataObj
{

};

class ProcOutBCA
{
public:
   void operator()(BoundIOs &boundIOs, EmptyDataObj &rowbuf)
   {

   }
};

class ProcOutParams {
public:
	long long_criteria;
	int numRecords;
	
	friend ostream &operator<<(ostream &o, const ProcOutParams &params)
	{
       cout << "ProcOutParams(" << params.long_criteria << ", " << params.numRecords << ")";
	   return o;
	}
};

class ProcOutBPA {
public:
 void operator()(BoundIOs &cols, ProcOutParams &params)
 {
  cols[0] << params.long_criteria;
  cols[1] >> params.numRecords;
 }
};

// Oracle stored procedure we wish to test
#if 0
   Create or replace procedure ExampleInfoProcOutParams

   (LONG_CRITERIA IN integer, NUM_RECORDS OUT integer)

   As
  
   Begin

   select count(*)

   into NUM_RECORDS

   from db_example

   where EXAMPLE_LONG = LONG_CRITERIA;

   End;
#endif

// simply does a select count(*) from db_example where example_long = 22
void StoredProcCountRecords() {

	DBView<EmptyDataObj, ProcOutParams> view("{call ExampleInfoProcOutParams(?, ?)}", 
		ProcOutBCA(), "", ProcOutBPA());

	// execute our stored procedure
	DBView<EmptyDataObj, ProcOutParams>::sql_iterator print_it = view.begin();

	print_it.Params().long_criteria = 22;

	*print_it = EmptyDataObj(); // force the statement to execute 
    ++print_it;

	cout << "number of records with EXAMPLE_LONG = 22 is " 
		 << print_it.Params().numRecords << endl;
}