summaryrefslogtreecommitdiff
path: root/ADBC/adbc/ODBC/ODBC_Exception.h
blob: 287418724c99a906abce34e4c802bda251b22f2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// -*- C++ -*-

//=============================================================================
/**
 * @file      Exception.h
 *
 * $Id$
 *
 * @author    James H. Hill
 */
//=============================================================================

#ifndef _ADBC_ODBC_EXCEPTION_H_
#define _ADBC_ODBC_EXCEPTION_H_

#include "adbc/Exception.h"
#include "ODBC.h"

namespace ADBC
{
namespace ODBC
{
/**
 * @class Exception
 *
 * @brief Base class for all ODBC exception classes.
 */
class ADBC_ODBC_Export Exception : public ::ADBC::Exception
{
public:
  /// Default constructor.
  Exception (void);

  /**
   * Initializing constructor.
   *
   * @param[in]       handle        Faulting ODBC handle.
   * @param[in]       type          Type of handle.
   */
  Exception (SQLHANDLE handle, SQLSMALLINT type);

  /**
   * Initializing constructor.
   *
   * @param[in]     message     Set the error message.
   */
  Exception (const char * message);

  /// Default destructor.
  virtual ~Exception (void);
};
}
}

#define SQL_ENV_VERIFY(op, handle) \
  SQL_VERIFY (op, ::ADBC::ODBC::Exception (handle, SQL_HANDLE_ENV))

/// Exception for an ODBC connection \a handle.
#define SQL_CONN_VERIFY(op, handle) \
  SQL_VERIFY (op, ::ADBC::ODBC::Exception (handle, SQL_HANDLE_DBC))

/// Exception for an ODBC statement \a handle.
#define SQL_STMT_VERIFY(op, handle) \
  SQL_VERIFY (op, ::ADBC::ODBC::Exception (handle, SQL_HANDLE_STMT))

/// Exception for an ODBC description \a handle.
#define SQL_DESC_VERIFY(op, handle) \
  SQL_VERIFY (op, ::ADBC::ODBC::Exception (handle, SQL_HANDLE_DESC))

#if defined (__ADBC_INLINE__)
#include "ODBC_Exception.inl"
#endif

#endif  // !defined _ADBC_ODBC_EXCEPTION_H_