MySQL++ Reference Manual

MySQL++: mysqlpp::UnixDomainSocketConnection Class Reference

MySQL++ 3.2.5

Public Member Functions | Static Public Member Functions | List of all members
mysqlpp::UnixDomainSocketConnection Class Reference

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

`#include <uds_connection.h>`

Inheritance diagram for mysqlpp::UnixDomainSocketConnection:
[legend]
Collaboration diagram for mysqlpp::UnixDomainSocketConnection:
[legend]

## 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. More...
| UnixDomainSocketConnection (const UnixDomainSocketConnection &other)
| Establish a new connection using the same parameters as an existing connection. More...
| ~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. More...
Public Member Functions inherited from mysqlpp::Connection
| Connection (bool te=true)
| Create object without connecting to the database server. More...
| Connection (const char *db, const char *server=0, const char *user=0, const char *password=0, unsigned int port=0)
| Create object and connect to database server in one step. More...
| Connection (const Connection &other)
| Establish a new connection using the same parameters as an existing connection. More...
virtual | ~Connection ()
| Destroy object.
std::string | client_version () const
| Get version of library underpinning the current database driver.
bool | connected () const
| Returns true if connection was established successfully. More...
ulonglong | count_rows (const std::string &table)
| Returns the number of rows in a table. More...
bool | create_db (const std::string &db)
| Ask the database server to create a database. More...
void | disconnect ()
| Drop the connection to the database server.
DBDriver * | driver ()
| Returns a reference to the current database driver.
bool | drop_db (const std::string &db)
| Asks the database server to drop (destroy) a database. More...
int | errnum ()
| Return last error number associated with this connection.
const char * | error () const
| Return error message for last error associated with this connection. More...
std::string | ipc_info () const
| Get information about the IPC connection to the database server. More...
bool | kill (unsigned long tid) const
| Kill a database server thread. More...
| operator private_bool_type () const
| Test whether any error has occurred within the object. More...
Connection & | operator= (const Connection &rhs)
| Copy an existing Connection object's state into this object.
bool | ping ()
| "Pings" the database server More...
int | protocol_version () const
| Returns version number of the protocol the database driver uses to communicate with the server.
Query | query (const char *qstr=0)
| Return a new query object. More...
Query | query (const std::string &qstr)
| Return a new query object. More...
bool | select_db (const std::string &db)
| Change to a different database managed by the database server we are connected to. More...
std::string | server_version () const
| Get the database server's version string.
bool | set_option (Option *o)
| Sets a connection option. More...
bool | shutdown ()
| Ask database server to shut down.
std::string | server_status () const
| Returns information about database server's status.
unsigned long | thread_id ()
| Returns the database server's thread ID for this connection. More...
Public Member Functions inherited from mysqlpp::OptionalExceptions
| OptionalExceptions (bool e=true)
| Default constructor. More...
virtual | ~OptionalExceptions ()
| Destroy object.
void | enable_exceptions () const
| Enable exceptions from the object.
void | disable_exceptions () const
| Disable exceptions from the object.
bool | throw_exceptions () const
| Returns true if exceptions are enabled.

## 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. More...
Static Public Member Functions inherited from mysqlpp::Connection
static bool | thread_aware ()
| Returns true if both MySQL++ and database driver we're using were compiled with thread awareness.
static void | thread_end ()
| Tells the underlying database driver that this thread is done using the library.
static bool | thread_start ()
| Tells the underlying database driver that the current thread is now using its services. More...

## Additional Inherited Members
Protected Member Functions inherited from mysqlpp::Connection
void | build_error_message (const char *core)
| Build an error message in the standard form used whenever one of the methods can't succeed because we're not connected to the database server.
void | copy (const Connection &other)
| Establish a new connection as a copy of an existing one. More...
bool | parse_ipc_method (const char *server, std::string &host, unsigned int &port, std::string &socket_name)
| Extract elements from the server parameter in formats suitable for passing to DBDriver::connect().
Protected Member Functions inherited from mysqlpp::OptionalExceptions
void | set_exceptions (bool e) const
| Sets the exception state to a particular value. More...
Protected Attributes inherited from mysqlpp::Connection
std::string | error_message_
| MySQL++ specific error, if any.

## 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

## ◆ UnixDomainSocketConnection() [1/2]

mysqlpp::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().

## ◆ UnixDomainSocketConnection() [2/2]

mysqlpp::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

## ◆ connect()

bool mysqlpp::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.

Referenced by UnixDomainSocketConnection().

## ◆ is_socket()

bool mysqlpp::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 mysqlpp::Connection::parse_ipc_method().

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

- uds_connection.h
- uds_connection.cpp