aboutsummaryrefslogtreecommitdiff
path: root/odb/mysql/connection-factory.hxx
blob: e316f18db3bc212ebb23237cc28afb483c388992 (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
// file      : odb/mysql/connection-factory.hxx
// author    : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
// license   : GNU GPL v2; see accompanying LICENSE file

#ifndef ODB_MYSQL_CONNECTION_FACTORY_HXX
#define ODB_MYSQL_CONNECTION_FACTORY_HXX

#include <odb/shared-ptr.hxx>

#include <odb/mysql/forward.hxx>
#include <odb/mysql/connection.hxx>

namespace odb
{
  namespace mysql
  {
    class connection_factory
    {
    public:
      virtual shared_ptr<connection>
      connect () = 0;

    public:
      typedef mysql::database database_type;

      virtual void
      database (database_type&) = 0;

      virtual
      ~connection_factory ();
    };

    class new_connection_factory: public connection_factory
    {
    public:
      new_connection_factory ()
          : db_ (0)
      {
      }

      virtual shared_ptr<connection>
      connect ();

      virtual void
      database (database_type&);

    private:
      database_type* db_;
    };
  }
}

#endif // ODB_MYSQL_CONNECTION_FACTORY_HXX