⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testexceptions.h

📁 The goal of this library is to make ODBC recordsets look just like an STL container. As a user, you
💻 H
字号:
// code in which we intentionally cause DTL to trip and throw exceptions// in order to make sure they work// Initial: 12/27/2000 - MG#ifndef _TEST_EXCEPTIONS_H#define _TEST_EXCEPTIONS_H#include "Example.h"// a BCA using an invalid column nameclass BadBCAExampleObj{public:	void operator()(BoundIOs &boundIOs, Example &rowbuf)    {	   boundIOs["INT_VALUE"] 	   == rowbuf.exampleInt;	   boundIOs["STRING_VALUE"]    == rowbuf.exampleStr;	   boundIOs["DOUBLE_VALUE"]    == rowbuf.exampleDouble;	   boundIOs["EXAMPLE_FOO"]   == rowbuf.exampleLong; // doesn't exist, should throw on Execute	   boundIOs["EXAMPLE_DATE"]   == rowbuf.exampleDate;	}};// a BPA using a parameter that's out of boundsclass BadBPAExampleObj{public:	void operator()(BoundIOs &boundIOs, DefaultParamObj<Example> &paramObj)	{	  boundIOs[0] == paramObj.lowIntValue;	  boundIOs[1] == paramObj.highIntValue;	  boundIOs[2] == paramObj.strValue;	  boundIOs[4] == paramObj.dateValue; // param # out of bounds, should throw on Execute	}};class BadDelBCAExampleObj{public:	void operator()(BoundIOs &boundIOs, Example &rowbuf)	{      boundIOs["STRING_VALUE"]       == rowbuf.exampleStr;	  boundIOs["EXAMPLE_DATE_BAD"]   == rowbuf.exampleDate; // throw	}};class BadDelBPAExampleObj{public:	void operator()(BoundIOs &boundIOs, DefaultParamObj<Example> &paramObj)	{	  boundIOs[0] == paramObj.strValue;	  boundIOs[2] == paramObj.lowIntValue; // throw	}};// SelValidate() which throws if INT_VALUE ends in a 3class BadSelValidate{public:	bool operator()(BoundIOs &boundIOs, Example &rowbuf)	{      return (rowbuf.exampleInt % 10 != 1);	}};// InsValidate() which throws if INT_VALUE equals 5class BadInsValidate{public:	bool operator()(Example &rowbuf)	{		return (rowbuf.exampleInt != 7);	}};// SelValidate() which throws on every third element read// bool BadSelValidate(BoundIOs &boundIOs, Example &rowbuf);// master function to test different exception casesvoid TestExceptions();// a function for each different casevoid TestBadBCASelect();void TestBadBPASelect();void TestBadSelValidate();void TestBadBCAInsert();void TestBadInsValidate();void TestBadBCAUpdate();void TestBadUpdateValidate();void TestBadBCADelete();void TestBadBPADelete();#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -