亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? exceptionhandling.htm

?? The goal of this library is to make ODBC recordsets look just like an STL container. As a user, you
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
          try {
		error_buffer.push_back(error information string)
	  } catch(..){
		set_buffer_overflow_flag
	  }
      }
      else {
          try {
		error_buffer.push_back(data + error information error information string); 
	  } catch(..) {
		set_buffer_overflow_flag
	  }
      }
}
</PRE>
<FONT FACE="Courier New" SIZE=2><P>(Here we assume the dereference operator *in, simply returns the contents of the internal buffer -- yes, we could code the read to happen on *in, but then we may end up having to return an empty object if the data-stream goes 'bad' and we do not want to throw.&nbsp; Here, setting end-of-stream for the bad() case lets us terminate the read in a no-throw() kind of way.). <BR>
<BR>
3. For OutputIterators use the similar logic for ++. On ++, try to write the next 'data' element.&nbsp; If fail() or bad(), push the resulting 'data' element into an error buffer similar to what is shown for InputIterator. <BR>
<BR>
4. Set up the i/o Iterators so that they do not throw on any of their operations. Then, if we invoke an algorithm f(InputIterator, OutputIterator) we will have the property that every element that could be read from the InputIterator was either fetched completely or logged to an error buffer (up to error buffer overflow).&nbsp; Similarly, every element that could be written to the OutputIterator was either written completely or logged to an error buffer.&nbsp; Here, one could imagine a *standard* function for accessing such an error buffer so that errors could be dealt with in a generic way. Still, this is not a very strong guarantee since f(In, Out) could abort for reasons unrelated to the iterators it is working on.&nbsp; In any case , I think the best we can hope for is consistency at the end of f(In, Out), which should be enforced by the item-wise aCi property of our iterator, regardless of whether we throw or not. </P>
</FONT><FONT ><P>&nbsp;</P>
</FONT><FONT FACE="Courier New" SIZE=2><H2>DTL Input and Output Iterators -- The Practice</H2>
<H3>DTL Iterators vs. Standard Streams - The Good, The Bad, and The Fail</H3>
</FONT><FONT FACE="Courier New" SIZE=2><P>When iterators encounter an error when either reading or writing to the database or in initializing or maintaining their state, they act like streams. Errors could occur either through the manipulation of a single element (the element fails to pass the test in an InsVal or SelVal method) or the iterator itself could end up in an unusable state (say, if the connection with the database is lost). This behavior is very much like the C++ standard library streams, which have similar characteristics in their possible states:</P>

<UL>
<LI>Previous operation was successful and the stream is alive and well - the stream is in a <STRONG>good</STRONG> state - corresponds to a successful read, write (or initialization) in DTL.</FONT><FONT > </LI>
</FONT><FONT FACE="Courier New" SIZE=2><LI>Single stream in or stream out operation failed but stream is salvageable - the stream is in a <STRONG>fail </STRONG>state - this condition corresponds to the DTL iterator scenario such as a failed InsVal or SelVal call.</FONT><FONT > </LI>
</FONT><FONT FACE="Courier New" SIZE=2><LI>The stream itself could become corrupted such as if trying to read from or write to a nonexistent file. If the stream reads from a file that is there when the stream was created, but then the carpet gets yanked out from the stream's feet by someone removing the file, the stream will spit out to a junk place on the disk or read trash from such a bogus location. In this case, the stream is said to be in a <STRONG>bad </STRONG>state. The DTL equivalent would occur in a situation such as losing the connection with the database. Any iterators which try to read or write using that invalid connection would become corrupted and thus leave themselves in an unrecoverable state.</FONT><FONT > </LI></UL>

</FONT><FONT FACE="Courier New" SIZE=2><P>So as with standard libary streams, iterators provide flags for each of these three states and their values are OR'ed together to get the appropriate effect: dtl_iostate::goodbit, dtl_iostate::failbit, and dtl_iostate::badbit. </FONT><FONT FACE="Courier New" SIZE=2>The iterators inherit from dtl_ios_base, which contains setstate(), rdbuf(), clear(), good(), fail(), and bad() functions that work just like their counterparts in std::ios_base except that setstate() and clear() do not throw if badbit or failbit are set. In the case of DTL, all of these state operations are nothrow.</P>
<STRONG><H2>Now Introducing Our Hero, IOHandler&lt;DataObj, ParamObj&gt;</H2>
</STRONG><FONT FACE="Courier New" SIZE=2><P>As described in the theory section above, there are fundamentally two main ways to deal with errors that occur while operating on an iterator.  The first method is to simply throw in the event of an error, which will usually abort any algorithm operating on that range / iterator.  In the throw case, we will usually want to rollback any operations performed on the range.  The first version of our hero, AlwaysThrowsHandler&lt;DataObj, ParamObj&gt, always tells the code that threw to rethrow the exception by returning dtl_ios_base::THROW_EXCEPTION. The assumption underlying this version of the error handler is that all errors should be passed back to the end-user who can then decide whether or not to roll back any changes made to the range.  Examples of range commit and rollback are shown later. The second way of dealing with errors is to simply log & suppress them with the assumption that they will be dealt with after the calling algorithm is done with the iterator.  This second method is supported by a version of our hero called LoggingHandler&lt;DataObj, ParamObj&gt;  which records errors to a vector&lt;string&gt; for later use and suppresses exceptions by returning dtl_ios_base::SUPPRESS_ERROR. To see how an error handler is defined we turn our X-ray vision on some example code:</P>
</FONT>
<FONT FACE="Courier New" SIZE=3>
<pre><code><span class="codeComment">// Let's Use our X-Ray Vision to Look at the Innards of our Hero</span>


template&lt;class DataObj, class ParamObj = DefaultParamObj&lt;DataObj&gt; &gt; class OurHeroicHandler
{
private:
	<span class="codeComment">// ... some state data, but assume handler is default constructible</span>
public:

	dtl_ios_base::MeansOfRecovery
		operator()(RootException &amp;ex, dtl_ios_base &amp;base,
		   DataObj &amp;data, ParamObj &amp;params)
	{
		<span class="codeComment">// example of what you might do in a handler</span>
		if (bad())
		{
			LogErrorToFile(ex);
			return dtl_ios_base::THROW_EXCEPTION;
		}
		else if (fail())
		{
			<span class="codeComment">// tries to make the DataObj valid and then reapplies previous operation
			// to base on the good object ... may still fail</span>
			bool failed = WorkMagicOnDataObjAndTryAgain(...);

			if (failed)
			{
				LogErrorToFile(ex);
				return dtl_ios_base::THROW_EXCEPTION;
			}
			else
				return dtl_ios_base::SUPPRESS_ERROR; <span class="codeComment">// success ... our superhero
								     // has saved the day!</span>
		}
	}
};
</code></pre>

 
</FONT>
<FONT FACE="Courier New" SIZE=2><P>The above handler instructs the code invoking the handler to still throw the exception if the iterator is in a bad state. In the case that the iterator has only failed and is salvageable, our hero weaves some magic on the DataObj and then reapplies the operation that failed on the iterator. If the retry of the operation succeeded, our hero has saved the day and the handler tells the invoking code that all is well. Otherwise, it is a dark day for the iterator and the invoking code will be told to throw. To tell what personality we would like our IOHandler to take for a given DB_iterator it, we simply invoke it.set_io_handler(), passing in an instance of our handler as the argument. Similarly, it.get_io_handler() will return the current handler for the iterator. Note that you must pass a NULL pointer to this method, e. g.: </P>
</FONT><FONT FACE="Courier New" SIZE=3><PRE>      it.get_io_handler((OurHeroicHandler&lt;DataObj, ParamObj&gt; *) NULL);</PRE></FONT>
<FONT FACE="Courier New" SIZE=2><P>Calling the similar members of the DBView&lt;DataObj, ParamObj&gt; template will set and get the default view for newly created iterators that refer to that view. Now you know everything needed to summon our superhero and to let him do his work to save the day!</P>
<FONT FACE="Courier New" SIZE=2><P>Now here's another example that shows the use of a logging handler class to report the exceptions that occur.<BR>
<FONT FACE="Courier New" SIZE=3>
<pre><code><span class="codeComment">// Example Code Using LoggingHandler on a DBView

// test of failed SelValidate() when reading data</span>
void TestBadSelValidate()
{
 	vector&lt;Example&gt; results;

	<span class="codeComment">// construct view
	// DBView&lt;Example&gt; is actually DBView&lt;Example, 
	// DefaultParamObj&lt;Example&gt; &gt; thanks to the default 
	// argument to the DBView template

	// use our bad BCA which references a nonexistent column name in DB_EXAMPLE</span>
	DBView&lt;Example&gt;
		view(&quot;DB_EXAMPLE&quot;, BCAExampleObj(),
		&quot;WHERE INT_VALUE BETWEEN (?) AND (?) AND &quot;
		&quot;STRING_VALUE = (?) OR EXAMPLE_DATE &lt; (?) ORDER BY EXAMPLE_LONG&quot;,
		BPAExampleObj(), BadSelValidate());

	<span class="codeComment">// loop through query results and add them to our vector
	// in this loop, read_it.GetLastCount() records read from DB</span>

	DBView&lt;Example&gt;::select_iterator read_it = view.begin();

	<span class="codeComment">// set parameter values for the WHERE clause in our SQL query</span>
	read_it.Params().lowIntValue = 2;
	read_it.Params().highIntValue = 8;
	read_it.Params().strValue = &quot;Example&quot;;
	
	TIMESTAMP_STRUCT paramDate = {2000, 1, 1, 0, 0, 0, 0};
	read_it.Params().dateValue = paramDate;

	for ( ; read_it != view.end(); read_it++)
	{
	try
		{
		  <span class="codeComment">// note that the read_iterator::GetLastCount()  is incremented in operator++()
		  // remember that the record is fetched and thus the count incremented
		  // before operator*() is applied to the read_iterator</span>

		  cout &lt;&lt; &quot;Reading element #&quot; &lt;&lt; read_it.GetLastCount() &lt;&lt; endl;
		  
		  cout &lt;&lt; &quot;read_it-&gt;exampleInt = &quot; &lt;&lt; read_it-&gt;exampleInt &lt;&lt; endl;
		  cout &lt;&lt; &quot;read_it-&gt;exampleStr = &quot; &lt;&lt; read_it-&gt;exampleStr &lt;&lt; endl;
		  
		  results.push_back(*read_it);
		}
		catch (RootException &amp;ex)
		{
		  cout &lt;&lt; &quot;Caught Exception!!!!&quot; &lt;&lt; endl;
		  cout &lt;&lt; ex.what() &lt;&lt; endl;
		}
	}

	LoggingHandler&lt;Example&gt; handler = 
		read_it.get_io_handler((LoggingHandler&lt;Example&gt; *) NULL);

	typedef LoggingHandler&lt;Example&gt;::LoggedTriple LoggedTriple;

	vector&lt;LoggedTriple&gt; errors = handler.GetLog();

	for (vector&lt;LoggedTriple&gt;::iterator log_it = errors.begin(); log_it != errors.end();
			log_it++)
	{
		LoggedTriple error = *log_it;

		cout &lt;&lt; &quot;Error msg = &quot; &lt;&lt; error.errmsg &lt;&lt; endl;
		cout &lt;&lt; &quot;Example = &quot; &lt;&lt; error.dataObj &lt;&lt; endl;
	}

}
</code></pre>
</FONT>
</FONT><FONT FACE="Courier New"><H3>Range commit and rollback</H3>
</FONT><FONT FACE="Courier New" SIZE=2><P>You can emulate transactions over ranges of operations using DBConnection::CommitAll() and DBConnection::RollbackAll().</P>
</FONT>
<FONT FACE="Courier New" SIZE=3>
<pre><code><span class="codeComment">// Range Transaction over a DBConnection: Insertion into a DBView </span>

const TIMESTAMP_STRUCT chrysalis = {2002, 4, 3, 0, 0, 0, 0};
const TIMESTAMP_STRUCT mikero = {2001, 11, 2, 0, 0, 0, 0};
const TIMESTAMP_STRUCT victory = {2001, 3, 10, 0, 0, 0, 0};

<span class="codeComment">// this example shows range insert transactions in action</span>
void RangeInsertExample()
{
	DBConnection conn;
        conn.Connect("UID=example;PWD=example;DSN=example;");

	typedef DBView<Example> DBV;

	DBV view("DB_EXAMPLE", DefaultBCA<Example>(), 
	   "", DefaultBPA<DefaultParamObj<Example> >(), DefaultSelValidate<Example>(),
	   DefaultInsValidate<Example>(), conn);

	cout << "Examples in view before attempted range insert:" << endl;

	copy(view.begin(), view.end(), ostream_iterator<Example>(cout, "\n"));

	vector<Example> read_from_DB_before;

	copy(view.begin(), view.end(), back_inserter(read_from_DB_before));

	<span class="codeComment">// examples that we want to insert into the DB ...
	// we want an all or nothing on these guys!</span>
	vector<Example> all_or_nothing_examples;

	<span class="codeComment">// third element will fail to be inserted, should force rollback</span>
	all_or_nothing_examples.push_back(Example(79, "FUBAR", 2.2, 99, mikero));
	all_or_nothing_examples.push_back(Example(81, "All Messed Up", 21.09, 75, chrysalis));
	all_or_nothing_examples.push_back(Example(85, "Bad Boy", -21.22, 11, victory));
	all_or_nothing_examples.push_back(Example(99, "Good One", 77.99, 41, victory));
	
	<span class="codeComment">// must write all the elements to succeed in the transaction</span>
	// else we rollback
	try { 
      
	  DBV::insert_iterator write_it = view;

	  write_it.set_io_handler(AlwaysThrowsHandler<Example>());

	  for (vector<Example>::iterator ins_it = all_or_nothing_examples.begin(); 
	      ins_it != all_or_nothing_examples.end(); ins_it++, write_it++)
		  {	  

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
97精品久久久久中文字幕| 欧美精品在线一区二区三区| 久久99精品久久久久久动态图| 亚洲一区二区三区自拍| 亚洲欧美另类小说| 中文字幕亚洲不卡| 亚洲丝袜自拍清纯另类| 亚洲色图.com| 亚洲一区在线视频| 婷婷一区二区三区| 日韩黄色片在线观看| 免费人成网站在线观看欧美高清| 蜜臀av国产精品久久久久| 麻豆国产欧美日韩综合精品二区| 精品中文字幕一区二区小辣椒| 久久不见久久见免费视频7 | 国产乱人伦偷精品视频免下载| 九色porny丨国产精品| 国产盗摄一区二区三区| 国产白丝精品91爽爽久久| 成人一区二区三区在线观看| 成人av资源下载| 欧美在线一二三四区| 4hu四虎永久在线影院成人| 精品动漫一区二区三区在线观看| 国产午夜精品理论片a级大结局| 久久美女艺术照精彩视频福利播放| 精品国产麻豆免费人成网站| 中文字幕 久热精品 视频在线| 色综合久久综合| 欧美日韩精品综合在线| 国产精品免费视频网站| 欧美一区二区三区视频在线观看 | 国产精品女同一区二区三区| 亚洲欧洲中文日韩久久av乱码| 亚洲电影一级片| 国模冰冰炮一区二区| 91免费看片在线观看| 欧美日韩色综合| 久久精品视频免费观看| 一区二区三区欧美视频| 麻豆精品久久久| 91在线视频免费观看| 欧美一区二区三区系列电影| 国产精品天天看| 亚洲成av人片在线观看无码| 国产成人亚洲综合色影视| 在线亚洲欧美专区二区| 久久综合九色综合欧美亚洲| 亚洲精品日产精品乱码不卡| 激情图片小说一区| 欧美伊人久久大香线蕉综合69| 日韩欧美国产不卡| 亚洲色图都市小说| 国产综合一区二区| 日本久久电影网| 欧美丰满少妇xxxbbb| 国产伦精品一区二区三区视频青涩 | 一区二区三区美女| 麻豆精品一区二区| 日本福利一区二区| 久久蜜桃av一区精品变态类天堂| 亚洲一二三专区| 国产91精品入口| 欧美一级高清大全免费观看| 亚洲六月丁香色婷婷综合久久| 国产毛片精品一区| 欧美一区二区在线免费播放| 亚洲手机成人高清视频| 国产真实乱子伦精品视频| 欧美精品v国产精品v日韩精品 | 国产91清纯白嫩初高中在线观看| 4438成人网| 亚洲综合一二区| 99久久精品情趣| 蜜臀va亚洲va欧美va天堂| 99久久精品免费看| 国产精品卡一卡二| 一区二区三区国产豹纹内裤在线| 国产一区视频在线看| 69堂国产成人免费视频| 一区二区欧美国产| av中文字幕在线不卡| 久久久精品欧美丰满| 久久机这里只有精品| 欧美日韩国产大片| 亚洲国产成人精品视频| 色综合久久久久网| 国产精品看片你懂得| 成人激情图片网| 国产网站一区二区三区| 国产一区二区三区蝌蚪| 久久综合色婷婷| 精品在线播放午夜| 精品理论电影在线| 麻豆精品在线播放| 精品国产在天天线2019| 丝袜a∨在线一区二区三区不卡 | 国产精品三级久久久久三级| 国产综合久久久久久鬼色| 欧美电影免费观看高清完整版| 日日摸夜夜添夜夜添国产精品| 欧美午夜精品久久久久久孕妇| 亚洲男人的天堂在线aⅴ视频| 99国产精品久久久久久久久久| 国产精品美女久久久久久久久久久| 国产成人免费av在线| 亚洲一区免费观看| 欧美午夜精品久久久| 午夜视频在线观看一区二区三区 | 亚洲欧美综合在线精品| 97久久精品人人澡人人爽| 亚洲婷婷综合久久一本伊一区 | 精品成人一区二区| 国产精品一区二区三区乱码| 亚洲国产精品激情在线观看| 成人h动漫精品一区二| 一区二区三区日韩欧美| 欧美日韩在线播| 久久99精品视频| 国产精品久久久久久妇女6080 | 国产精品天天看| 色综合夜色一区| 亚洲午夜av在线| 欧美一三区三区四区免费在线看 | av电影在线观看完整版一区二区| 亚洲欧美一区二区不卡| 欧美性大战久久久久久久| 免费人成黄页网站在线一区二区| 欧美videossexotv100| 成人免费不卡视频| 夜夜嗨av一区二区三区四季av| 欧美高清dvd| 国产精品一线二线三线| 亚洲日本在线天堂| 正在播放亚洲一区| 国产成人亚洲综合a∨婷婷图片| 中文字幕一区二区三区不卡在线| 欧美性受极品xxxx喷水| 久久精品免费看| 亚洲丝袜自拍清纯另类| 7777精品久久久大香线蕉| 国产精品77777竹菊影视小说| 伊人性伊人情综合网| 日韩欧美久久一区| 91色九色蝌蚪| 韩国女主播成人在线| 亚洲精品高清在线| 亚洲精品一区二区三区福利| 91美女在线观看| 精一区二区三区| 一区二区三区毛片| 久久免费视频色| 欧美日韩视频不卡| 不卡一区在线观看| 丝袜国产日韩另类美女| 亚洲欧洲一区二区在线播放| 欧美一区二区精品在线| 91视频免费播放| 国产高清精品网站| 日韩在线a电影| 中文字幕欧美一| 日韩一区二区中文字幕| 91美女福利视频| 国产毛片精品视频| 日韩不卡一区二区| 亚洲精品日韩综合观看成人91| 久久你懂得1024| 日韩一区二区免费电影| 色婷婷激情综合| 国产成人在线视频网站| 日韩成人免费看| 亚洲一区二三区| 亚洲色图.com| 国产丝袜欧美中文另类| 日韩久久久精品| 欧美日韩在线不卡| 色天使色偷偷av一区二区| 懂色av中文一区二区三区| 三级不卡在线观看| 欧美一级淫片007| 国产一区中文字幕| 奇米精品一区二区三区四区 | 免费人成在线不卡| 亚洲第一av色| 亚洲精品成人精品456| 国产精品乱码久久久久久| 久久久久国色av免费看影院| 中文字幕第一区| 日韩欧美一二区| 欧美一级午夜免费电影| 欧美理论片在线| 欧美在线不卡视频| 97se狠狠狠综合亚洲狠狠| 成人丝袜高跟foot| 国产成人在线观看免费网站| 精品一区二区三区免费播放| 免费不卡在线视频| 毛片一区二区三区| 美女视频第一区二区三区免费观看网站|