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

📄 exceptionoverview.htm

📁 The goal of this library is to make ODBC recordsets look just like an STL container. As a user, you
💻 HTM
字号:
<html>

 

<head>
<style>
CODE {COLOR: #990000;}
.code{COLOR: #990000}
.codeComment{COLOR: #008000}
.codeHighlight{BACKGROUND-COLOR: #FFFF00}
.codeFileName{FONT-WEIGHT: bold;}
</style>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Gradman">
<meta name="KeyWords"
content="DTL, Oracle, ODBC, database API, C++, Template Library">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<!--
  -- Copyright 2000
  -- Michael Gradman & Corwin Joy
  --
  -- Permission to use, copy, modify, distribute and sell this software
  -- and its documentation for any purpose is hereby granted without fee,
  -- provided that the above copyright notice appears in all copies and
  -- that both that copyright notice and this permission notice appear
  -- in supporting documentation.  Corwin Joy & Michael Gradman make no
  -- representations about the suitability of this software for any
  -- purpose.  It is provided "as is" without express or implied warranty.
  --
  --
  -- Copyright (c) 1996-1999
  -- Silicon Graphics Computer Systems, Inc.
  --
  -- Permission to use, copy, modify, distribute and sell this software
  -- and its documentation for any purpose is hereby granted without fee,
  -- provided that the above copyright notice appears in all copies and
  -- that both that copyright notice and this permission notice appear
  -- in supporting documentation.  Silicon Graphics makes no
  -- representations about the suitability of this software for any
  -- purpose.  It is provided "as is" without express or implied warranty.
  --
  -- Copyright (c) 1994
  -- Hewlett-Packard Company
  --
  -- Permission to use, copy, modify, distribute and sell this software
  -- and its documentation for any purpose is hereby granted without fee,
  -- provided that the above copyright notice appears in all copies and
  -- that both that copyright notice and this permission notice appear
  -- in supporting documentation.  Hewlett-Packard Company makes no
  -- representations about the suitability of this software for any
  -- purpose.  It is provided "as is" without express or implied warranty.
  --
  -->
<!-- Generated by htmldoc -->
<title>Exceptions in the Database TemplateLibrary: An Overview</title>
</head>

<body bgcolor="#FFFFFF" text="#000000" link="#0000EE"
vlink="#551A8B" alink="#FF0000">

<p><font size="6" face="Bookman Old Style"><em><strong><u>dtl</u></strong></em></font></p>

<p><img src="stat.gif" width="6" height="6"> <!--end header--> <br>
</p>
<h1>Exceptions in the Database Template Library: An Overview</h1>

<p>The Database Template Library (DTL) attempts to be robust in
the services it provides. To be robust, a piece of software
must maintain uncorrputed data structures and recover to resume 
normal execution if possible in the face of errors.
Errors must be reported in a clear manner and allow the user
to track down exactly what went wrong in the running of the
program. In addition, the user should have some control over what kind of
behavior will take place if an error is encountered. DTL 
addresses these issues by providing:</p>

<ul type="disc">
    <li>Code written in an exception-safe manner to where
        atomicity and consistency are maintained wherever
        possible. <br>
        <br>
        </li>
    <li>A clear and easy to understand exception hierarchy which
        describes the various kinds of problems that can
        occur during execution. This allows for
        easier debugging as you know exactly what code threw and
        get a clear idea of the problem. Exception classes in DTL inherit from
        a base called RootException and describe specific common cases in DTL:
        <p><a href="DBException.htm">DBException:</a> describes
        problems that occur either at the API level or the ODBC/database
        level dealing with reading or writing to the database,
        either in IndexedDBView, DBView, or DBStmts (or their
        iterators). </p>
        <p><a href="ETIException.htm">ETIException:</a> gives an
        error message about what went wrong with the
        extended type information provided for SQL &lt;---&gt; C
        type mappings, usually unrecognized types.</p>
        <p><a href="ValidityException.htm">ValidityException:</a>
        describes errors thrown from ValidatedObject's (specifically
        for DBConnection and DBStmt objects), indicating the
        object has hit an invalid state and cannot be recovered
        without a call to the virtual method ValidatedObject::revalidate().</p>
        <p><a href="VariantException.htm">VariantException:</a>
        thrown for errors that occur with variant objects such as
        variant_row, variant_fields, and IOHandlers (handlers
        are implemented as variant objects). If we can't find a
        member such as a function name or cast properly, then we
        throw this exception.<br>
        </p>
    </li>
    <li>All DTL iterator classes (DB_iterator and its subclasses)
        support a notion of handlers. Each iterator maintains its
        own state based on the operations it performs similar to
        the C++ standard library's iostreams. They have good(),
        bad(), and fail() methods plus the other methods which
        are defined in std::ios_base.
        DTL's notion of handlers is similar to C++'s concept of
        new_handler that is invoked when the memory manager fails
        to allocate memory on operator new(). DTL has handlers
        known as IOHandlers, which are function objects that the
        user can set using DB_iterator::set_io_handler()
        and will be invoked when an exception is thrown by code
        executed by that iterator. The handler decides what
        actions to take based on the state of the iterator and
        tells the caller whether to suppress the error
        or to re-throw the exception. DTL also
        provides two pre-defined handlers for common cases:
        AlwaysThrowsHandler (which always just tells the code to
        re-throw and does nothing else) and LoggingHandler (which
        logs exceptions to a vector with useful information that
        can aid the user in tracking down the problem, always
        telling the caller to ignore the error). IOHandlers give the user 
	more control over what they want
        to do with exceptions. <br>
        <br>
        </li>
    <li>The notion of transactions over a range. In other words,
        the ability to insert or update multiple rows and roll
        the entire operation back if it is not completely
        successful. This is a must for both exception safety
        purposes and to provide proper support for the notion of
        database transactions.</li>
</ul>

<p>More information and examples on the above items can be found in the &quot;<a
href="ExceptionHandling.htm">Exception Safety in DTL</a>&quot;
document. </p>


<hr>

<p><a href="index.htm"><img src="dtl_home.gif" alt="[DTL Home]"
width="54" height="54"></a> <br>
</p>

<p>Copyright 

⌨️ 快捷键说明

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