Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
drivermanager.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file drivermanager.h
1 /*
2  This file is part of libodbc++.
3 
4  Copyright (C) 1999-2000 Manush Dodunekov <manush@stendahls.net>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING. If not, write to
18  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  Boston, MA 02111-1307, USA.
20 */
21 
22 #ifndef __ODBCXX_DRIVERMANAGER_H
23 #define __ODBCXX_DRIVERMANAGER_H
24 
25 #include <RDBC/odbc++/setup.h>
26 
27 #include <RDBC/odbc++/types.h>
28 
30 namespace odbc {
31 
32  class Connection;
33 
37  private:
39  std::vector<ODBCXX_STRING> attributes_;
40 
41  Driver(const Driver&); //forbid
42  Driver& operator=(const Driver&); //forbid
43 
44  public:
47  const std::vector<ODBCXX_STRING>& attributes)
48  :description_(description), attributes_(attributes) {}
49 
51  virtual ~Driver() {}
52 
54  const ODBCXX_STRING& getDescription() const {
55  return description_;
56  }
57 
59  const std::vector<ODBCXX_STRING>& getAttributes() const {
60  return attributes_;
61  }
62  };
63 
66 
67 
70  private:
73 
74  public:
77  :name_(name), description_(description) {}
78 
80  virtual ~DataSource() {}
81 
83  const ODBCXX_STRING& getName() const {
84  return name_;
85  }
86 
88  const ODBCXX_STRING& getDescription() const {
89  return description_;
90  }
91  };
92 
95 
96 
100  private:
101  static SQLHENV henv_;
102  static ErrorHandler* eh_;
103  static int loginTimeout_;
104 
105  static void _checkInit();
106  static Connection* _createConnection();
107 
108  // forbid
109  DriverManager();
110 
111  public:
112 
114  static Connection* getConnection(const ODBCXX_STRING& dsn,
115  const ODBCXX_STRING& user,
116  const ODBCXX_STRING& password);
117 
121  static Connection* getConnection(const ODBCXX_STRING& connectString);
122 
126  static int getLoginTimeout();
127 
132  static void setLoginTimeout(int seconds);
133 
136  static DataSourceList* getDataSources();
137 
140  static DriverList* getDrivers();
141 
145  static void shutdown();
146  };
147 
148 
149 
150 };
151 
152 
153 #endif // __ODBCXX_DRIVERMANAGER_H