Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: Connection::connect() interface is changing

From: Warren Young <mysqlpp(at)etr-usa.com>
Date: Sat Jul 14 2007 - 00:50:00 EDT


Warren Young wrote:
> class Connection ... {
> public:
> class TCP {
> public:
> TCP(host, user, port, etc...);
> }
> Connection(const TCP& tcp);
>
> #ifdef MYSQLPP_PLATFORM_WINDOWS
> class NamedPipes {
> public:
> NamedPipes();
> }
> Connection(const NamedPipes& np);
> #else
> class DomainSockets {
> public:
> DomainSockets(path);
> }
> Connection(const DomainSockets& ds);
> #endif
> }

I'm a dunce. The solution is staring me right in the face: inheritance!   This is a perfect is-a relationship. Just make one lightweight subclass of Connection for each connection style. Then, depending on how we're feeling about code compatibility, we can either retain the candy machine ctor in the parent class, or make Connection's ctor private and make the subclasses call mysql_real_connect() themselves.

-- 
MySQL++ Mailing List
For list archives: 
http://lists.mysql.com/plusplus
To unsubscribe:    
http://lists.mysql.com/plusplus?unsub=lists@pantek.com
Received on Sat Jul 14 00:48:27 2007

This archive was generated by hypermail 2.1.8 : Thu Aug 02 2007 - 01:56:49 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library