MySQLaux 0.6 is free software from Langensoft written by Thomas Langen.

Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

MySQLaux::Database Class Reference

Database. More...

#include <Database.h>

List of all members.

Public Methods

 Database (string const &host=string(), string const &user=string(), string const &passwd=string(), string const &dbname=string(), unsigned port=0, string const &socket=string(), unsigned clientflag=0) throw (Error)
 Constructor. More...

 ~Database ()
 Destructor. More...

char const* host () const
 Get host. More...

char const* user () const
 Get user. More...

char const* password () const
 Get password. More...

char const* dbname () const
 Get dbname. More...

unsigned port () const
 Get port. More...

char const* socket () const
 Get socket. More...

unsigned clientflag () const
 Get clientflag. More...

MYSQL& mysql ()
 Get MYSQL structure. More...

GarbageCollectorgc ()
 Get reference to garbage collector. More...

bool is_accessible () throw (Error)
 Is database accessible ? Tries to ping the server. More...

Table const query (const string &q) throw (Error, MissingFeature)
 Get table as result of query. More...

Detailed Description


The main class providing a connection to an existing MySQL database. An instance of this class is required for all further use of this package.
An internal garbage collector attribute deals with all memory tasks of this package.

Definition at line 70 of file Database.h.

Constructor & Destructor Documentation

MySQLaux::Database::Database ( string const & host = string(),
string const & user = string(),
string const & passwd = string(),
string const & dbname = string(),
unsigned port = 0,
string const & socket = string(),
unsigned clientflag = 0 ) throw (Error)


host   optional host database server runs on. Either a literal hostname or an IP address. If none given "localhost" is tried.
user   optional name of user connecting. If none given the user running the application is tried.
passwd   optional user password. If none given only password-free MySQL databases can be accessed.
dbname   optional database name to connect to. If none is given the connection can only be used to create a new database.
port   optional port mysql server listens to via TCP/IP. Defaults to the one given in the Betwork Services configuration file (usually 3306 from /etc/services)
socket   optional socket mysql server listens to for local connections. If given specifies the unix socket that should be used for the connection.
clientflag   optional MySQL client flag. Required in very special circumstances:
Flag nameFlag meaning
CLIENT_FOUND_ROWSReturn the number of found (matched) rows, not the number of affected rows
CLIENT_NO_SCHEMADon't allow the db_name.tbl_name.col_name syntax. This is for ODBC; it causes the parser to generate an error if you use that syntax, which is is useful for trapping bugs in some ODBC programs.
CLIENT_COMPRESSUse compression protocol
CLIENT_ODBCThe client is an ODBC client. This changes mysqld to be more ODBC-friendly.

MySQLaux::Database::~Database ( )


Member Function Documentation

unsigned MySQLaux::Database::clientflag ( ) const [inline]

Get clientflag.

Definition at line 152 of file Database.h.

00153     {
00154       return _clientflag;

char const * MySQLaux::Database::dbname ( ) const [inline]

Get dbname.

Definition at line 137 of file Database.h.

00138     {
00139       return _dbname;

GarbageCollector & MySQLaux::Database::gc ( ) [inline]

Get reference to garbage collector.

See also:

Definition at line 168 of file Database.h.

00169     {
00170       return _gc;

char const * MySQLaux::Database::host ( ) const [inline]

Get host.

Definition at line 122 of file Database.h.

00123     {
00124       return _host;

bool MySQLaux::Database::is_accessible ( ) throw (Error)

Is database accessible ? Tries to ping the server.

MYSQL & MySQLaux::Database::mysql ( ) [inline]

Get MYSQL structure.

Definition at line 159 of file Database.h.

00160     {
00161       return _mysql;

char const * MySQLaux::Database::password ( ) const [inline]

Get password.

Definition at line 132 of file Database.h.

00133     {
00134       return _password;

unsigned MySQLaux::Database::port ( ) const [inline]

Get port.

Definition at line 142 of file Database.h.

00143     {
00144       return _port;

Table const MySQLaux::Database::query ( const string & q ) throw (Error, MissingFeature)

Get table as result of query.

q   the SQL text sent to the database server
table returned from the server; may be empty

char const * MySQLaux::Database::socket ( ) const [inline]

Get socket.

Definition at line 147 of file Database.h.

00148     {
00149       return _socket;

char const * MySQLaux::Database::user ( ) const [inline]

Get user.

Definition at line 127 of file Database.h.

00128     {
00129       return _user;

The documentation for this class was generated from the following file:
Generated at Fri Apr 6 11:20:13 2001 for MySQLaux by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001