// Enforce business rule for inserted rows

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
};

// specialization of DefaultInsValidate for Example
// can have any number of InsValidate functions for a single data class just as with
// ParamObj's ... below is general business rule constraint we wish to enforce for all Examples
template<> class dtl::DefaultInsValidate<Example> {
public: 
bool operator()(Example &rowbuf)
{
	// data is valid if rowbuf.exampleStr is nonempty and rowbuf.exampleDouble is 
	// between 0 and 100 (like a percentage)
	return (rowbuf.exampleStr.length() > 0 && rowbuf.exampleDouble >= 0.0 &&
		rowbuf.exampleLong <= 100.0);
}
};