summaryrefslogtreecommitdiff
path: root/ADBC/adbc/SQLite/Connection.h
blob: 68d582a67d677c36a72a44452fd72c4350bc4383 (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
// -*- C++ -*-

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

#ifndef _ADBC_SQLITE_CONNECTION_H_
#define _ADBC_SQLITE_CONNECTION_H_

#include "adbc/Connection.h"
#include "ace/SString.h"
#include "Query.h"

// Forward decl.
struct sqlite3;

namespace ADBC
{
namespace SQLite
{
// Forward decl.
class Exception;

/**
 * @class Connection
 *
 * Implementation of a SQLite connection.
 */
class ADBC_SQLITE_Export Connection : public ADBC::Connection
{
  // Friend decl.
  friend class Query;

  // Friend decl.
  friend class Exception;

public:
  /// Default constructor
  Connection (void);

  /// Destructor.
  virtual ~Connection (void);

  /**
   * Connect to the specified database.
   *
   * @param[in]       connstr       Connection string for database
   * @param[in]       flags         Flags for the connection
   * @param[in]       vfs           File system flags
   */
  void connect (const ACE_CString & connstr, long flags, const char * vfs = 0);

  /**
   * Connect to the specified database.
   *
   * @param[in]       connstr       Connection string for database.
   */
  virtual void connect (const ACE_CString & connstr);

  /// Disconnect from the database.
  virtual void disconnect (void);

  /// Create a new SQLite query.
  virtual Query * create_query (void);

private:
  /// Connection the database.
  sqlite3 * conn_;
};
}
}

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

#endif  // !defined _ADBC_SQLITE_CONNECTION_H_