libtabula::UnixDomainSocketConnection Class Reference

Specialization of Connection for Unix domain sockets. More...

#include <uds_connection.h>

Inheritance diagram for libtabula::UnixDomainSocketConnection:
Inheritance graph
[legend]
Collaboration diagram for libtabula::UnixDomainSocketConnection:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 UnixDomainSocketConnection ()
 Create object without connecting it to the MySQL server.
 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.
 UnixDomainSocketConnection (const UnixDomainSocketConnection &other)
 Establish a new connection using the same parameters as an existing connection.
 ~UnixDomainSocketConnection ()
 Destroy object.
bool connect (const char *path, const char *db=0, const char *user=0, const char *password=0)
 Connect to database after object is created.

Static Public Member Functions

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.

Detailed Description

Specialization of Connection for Unix domain sockets.

This class just simplifies the connection creation interface of Connection. It does not add new functionality.


Constructor & Destructor Documentation

libtabula::UnixDomainSocketConnection::UnixDomainSocketConnection ( const char *  path,
const char *  db = 0,
const char *  user = 0,
const char *  password = 0 
) [inline]

Create object and connect to database server over Unix domain sockets in one step.

Parameters:
path filesystem path to socket
db name of database to use
user user name to log in under, or 0 to use the user name the program is running under
password password to use when logging in

BEWARE: These parameters are not in the same order as those in the corresponding constructor for Connection. This is a feature, not a bug. :)

References connect().

libtabula::UnixDomainSocketConnection::UnixDomainSocketConnection ( const UnixDomainSocketConnection other  )  [inline]

Establish a new connection using the same parameters as an existing connection.

Parameters:
other pre-existing connection to clone

Member Function Documentation

bool libtabula::UnixDomainSocketConnection::connect ( const char *  path,
const char *  db = 0,
const char *  user = 0,
const char *  password = 0 
)

Connect to database after object is created.

It's better to use the connect-on-create constructor if you can. See its documentation for the meaning of these parameters.

If you call this method on an object that is already connected to a database server, the previous connection is dropped and a new connection is established.

References libtabula::Connection::error_message_, is_socket(), and libtabula::OptionalExceptions::throw_exceptions().

Referenced by UnixDomainSocketConnection().

bool libtabula::UnixDomainSocketConnection::is_socket ( const char *  path,
std::string *  error = 0 
) [static]

Check that the given path names a Unix domain socket and that we have read-write permission for it.

Parameters:
path the filesystem path to the socket
error on failure, reason is placed here; take default if you do not need a reason if it fails
Returns:
false if address fails to pass sanity checks

Referenced by connect(), and libtabula::Connection::parse_ipc_method().


The documentation for this class was generated from the following files:

Generated on 26 May 2014 for Libtabula by  doxygen 1.6.1