MySQL++  3.2.5
uds_connection.h
Go to the documentation of this file.
1 
4 /***********************************************************************
5  Copyright (c) 2007-2008 by Educational Technology Resources, Inc.
6  Others may also hold copyrights on code in this file. See the
7  CREDITS.txt file in the top directory of the distribution for details.
8 
9  This file is part of MySQL++.
10 
11  MySQL++ is free software; you can redistribute it and/or modify it
12  under the terms of the GNU Lesser General Public License as published
13  by the Free Software Foundation; either version 2.1 of the License, or
14  (at your option) any later version.
15 
16  MySQL++ is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
19  License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public
22  License along with MySQL++; if not, write to the Free Software
23  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
24  USA
25 ***********************************************************************/
26 
27 #if !defined(MYSQLPP_UDS_CONNECTION_H)
28 #define MYSQLPP_UDS_CONNECTION_H
29 
30 #include "connection.h"
31 
32 namespace mysqlpp {
33 
38 
39 class UnixDomainSocketConnection : public Connection
40 {
41 public:
44  Connection()
45  {
46  }
47 
60  UnixDomainSocketConnection(const char* path, const char* db = 0,
61  const char* user = 0, const char* password = 0) :
62  Connection()
63  {
64  connect(path, db, user, password);
65  }
66 
72  Connection(other)
73  {
74  }
75 
78 
87  bool connect(const char* path, const char* db = 0,
88  const char* user = 0, const char* password = 0);
89 
98  static bool is_socket(const char* path, std::string* error = 0);
99 
100 private:
105  UnixDomainSocketConnection(const char*, const char*, const char*,
106  const char*, unsigned int) { }
107 
110  bool connect(const char*, const char*, const char*, const char*,
111  unsigned int) { return false; }
112 };
113 
114 
115 } // end namespace mysqlpp
116 
117 #endif // !defined(MYSQLPP_UDS_CONNECTION_H)
118 
mysqlpp::UnixDomainSocketConnection::UnixDomainSocketConnection
UnixDomainSocketConnection()
Create object without connecting it to the MySQL server.
Definition: uds_connection.h:85
exceptions.h
Declares the MySQL++-specific exception classes.
mysqlpp::UnixDomainSocketConnection::is_socket
static bool is_socket(const char *path, std::string *error=0)
Check that the given path names a Unix domain socket and that we have read-write permission for it.
Definition: uds_connection.cpp:67
mysqlpp::Connection
Manages the connection to the database server.
Definition: connection.h:81
mysqlpp::UnixDomainSocketConnection
Specialization of Connection for Unix domain sockets.
Definition: uds_connection.h:60
mysqlpp::Connection::error
const char * error() const
Return error message for last error associated with this connection.
Definition: connection.cpp:185
mysqlpp::Connection::Connection
Connection(bool te=true)
Create object without connecting to the database server.
Definition: connection.cpp:38
mysqlpp::UnixDomainSocketConnection::connect
bool connect(const char *path, const char *db=0, const char *user=0, const char *password=0)
Connect to database after object is created.
Definition: uds_connection.cpp:45
mysqlpp::UnixDomainSocketConnection::~UnixDomainSocketConnection
~UnixDomainSocketConnection()
Destroy object.
Definition: uds_connection.h:119
mysqlpp::ConnectionFailed
Exception thrown when there is a problem related to the database server connection.
Definition: exceptions.h:350
connection.h
Declares the Connection class.
common.h
This file includes top-level definitions for use both internal to the library, and outside it....
uds_connection.h
Declares the UnixDomainSocketConnection class.