MySQL++: uds_connection.h Source File
uds_connection.h
Go to the documentation of this file.
/***********************************************************************
Copyright (c) 2007-2008 by Educational Technology Resources, Inc.
Others may also hold copyrights on code in this file. See the
CREDITS.txt file in the top directory of the distribution for details.
This file is part of MySQL++.
MySQL++ is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
MySQL++ is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with MySQL++; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
***********************************************************************/
#if !defined(MYSQLPP_UDS_CONNECTION_H)
#define MYSQLPP_UDS_CONNECTION_H
#include "connection.h"
namespace mysqlpp {
class UnixDomainSocketConnection : public Connection
{
public:
UnixDomainSocketConnection() :
Connection()
{
}
UnixDomainSocketConnection(const char* path, const char* db = 0,
const char* user = 0, const char* password = 0) :
Connection()
{
connect(path, db, user, password);
}
UnixDomainSocketConnection(const UnixDomainSocketConnection& other) :
Connection(other)
{
}
~UnixDomainSocketConnection() { }
bool connect(const char* path, const char* db = 0,
const char* user = 0, const char* password = 0);
static bool is_socket(const char* path, std::string* error = 0);
private:
UnixDomainSocketConnection(bool) { }
UnixDomainSocketConnection(const char*, const char*, const char*,
const char*, unsigned int) { }
bool connect(const char*, const char*, const char*, const char*,
unsigned int) { return false; }
};
} // end namespace mysqlpp
#endif // !defined(MYSQLPP_UDS_CONNECTION_H)
mysqlpp::Connection
Manages the connection to the database server.
Definition: 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::UnixDomainSocketConnection
Specialization of Connection for Unix domain sockets.
Definition: uds_connection.h:40
mysqlpp::UnixDomainSocketConnection::UnixDomainSocketConnection
UnixDomainSocketConnection(const char *path, const char *db=0, const char *user=0, const char *password=0)
Create object and connect to database server over Unix domain sockets in one step.
Definition: uds_connection.h:60
mysqlpp::UnixDomainSocketConnection::UnixDomainSocketConnection
UnixDomainSocketConnection()
Create object without connecting it to the MySQL server.
Definition: uds_connection.h:43
mysqlpp::UnixDomainSocketConnection::~UnixDomainSocketConnection
~UnixDomainSocketConnection()
Destroy object.
Definition: uds_connection.h:77
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::UnixDomainSocketConnection::UnixDomainSocketConnection
UnixDomainSocketConnection(const UnixDomainSocketConnection &other)
Establish a new connection using the same parameters as an existing connection.
Definition: uds_connection.h:71
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
connection.h
Declares the Connection class.