// Example for Local BCA's and BPA's

class Example
{
  public:                                       // tablename.columnname:
	int exampleInt;                         // DB_EXAMPLE.INT_VALUE
	string exampleStr;                      // DB_EXAMPLE.STRING_VALUE
	double exampleDouble;                   // DB_EXAMPLE.DOUBLE_VALUE
	long exampleLong;                       // DB_EXAMPLE.EXAMPLE_LONG
	TIMESTAMP_STRUCT exampleDate;           // DB_EXAMPLE.EXAMPLE_DATE
};


vector<Example> ReadDataLocalBCA()
{
    // declare our BCA locally
    // note how we bind using the quasi-BoundIOs named COLS
    // and each binding is separated by operator&&() rather than semicolons
    
    Example rowbuf;  // object used by BCA() to guide binding process
    
   
    DBView<Example> view("DB_EXAMPLE",
        BCA(rowbuf,
            COLS["INT_VALUE"]      >> rowbuf.exampleInt &&
            COLS["STRING_VALUE"]   >> rowbuf.exampleStr &&
	    COLS["DOUBLE_VALUE"]   >> rowbuf.exampleDouble &&
	    COLS["EXAMPLE_LONG"]   >> rowbuf.exampleLong &&
	    COLS["EXAMPLE_DATE"]   >> rowbuf.exampleDate
        )
    );

    // copy DB_EXAMPLE records that matched the query into the vector and return
    vector<Example> results;
    copy(view.begin(), view.end(), back_inserter(results));
    return results;
}