blob: 41eea1afd13d1cc0f5a17bf5da64c6a81a6c46a8 (
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
// -*- C++ -*-
//=============================================================================
/**
* @file ODBC_Connection.h
*
* $Id$
*
* @author James H. Hill
*/
//=============================================================================
#ifndef _ADBC_ODBC_CONNECTION_H_
#define _ADBC_ODBC_CONNECTION_H_
#include "ODBC_Env.h"
#include "ODBC_Exception.h"
#include "ODBC_Query.h"
#include "adbc/Connection.h"
namespace ADBC
{
namespace ODBC
{
// Forward decl.
class Query;
/**
* @class Connection
*
* @brief Wrapper class for handling ODBC connection objects.
*
* This class provides a minimal set of operations used in ADBC for
* creating connection to a database using the ODBC protocol. Futhermore,
* this class is the only way to create an ODBC_Query object for performing
* SQL queries using the ODBC protocol.
*/
class ADBC_ODBC_Export Connection :
public ::ADBC::Connection
{
// Friend decl.
friend class Query;
public:
/// Constructor
Connection (Environment * env = Environment::instance ());
/// Destructor
virtual ~Connection (void);
/**
* Establish connection of an ODBC database. The connection string
* is a full connection string that depends on the target database
* driver. For a complete list of ODBC connection string formats,
* please see the following location:
*
* http://www.connectionstrings.com
*
* @param[in] connstr The connection string.
*/
virtual void connect (const ACE_CString & connstr);
/// Close the existing connection
virtual void disconnect (void);
/**
* Create an ODBC query object.
*
* @return Pointer to the database query.
*/
virtual ::ADBC::ODBC::Query * create_query (void);
/// Get the underlying handle to the connection.
HDBC handle (void) const;
private:
/// Initialize the connection.
void init (void);
/// Handle to the database connection
HDBC handle_;
/// Pointer to the target environment.
Environment * env_;
};
}
}
#if defined (__ADBC_INLINE__)
#include "ODBC_Connection.inl"
#endif
#endif // !defined _ADBC_ODBC_CONNECTION_H_
|