List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:July 14 2007 4:50am
Subject:Re: Connection::connect() interface is changing
View as plain text  
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.
Thread
Connection::connect() interface is changingWarren Young13 Jul
  • Re: Connection::connect() interface is changingDrew M.13 Jul
    • Re: Connection::connect() interface is changingWarren Young13 Jul
  • RE: Connection::connect() interface is changingYuantu.Huang13 Jul
    • Re: Connection::connect() interface is changingWarren Young13 Jul
      • RE: Connection::connect() interface is changingJoel Fielder13 Jul
        • RE: Connection::connect() interface is changingWilliam F. Dowling13 Jul
        • Re: Connection::connect() interface is changingWarren Young14 Jul
          • Re: Connection::connect() interface is changingWarren Young14 Jul
            • Re: Connection::connect() interface is changingAlex Burton15 Jul
              • Re: Connection::connect() interface is changingPeter Garner15 Jul
              • Re: Connection::connect() interface is changingWarren Young16 Jul
          • RE: Connection::connect() interface is changingJoel Fielder16 Jul
            • Re: Connection::connect() interface is changingWarren Young16 Jul
              • Re: Connection::connect() interface is changingAxel Howind16 Jul
                • Re: Connection::connect() interface is changingWarren Young16 Jul
  • Re: Connection::connect() interface is changingAxel Howind13 Jul
    • Re: Connection::connect() interface is changingWarren Young14 Jul
      • Re: Connection::connect() interface is changingAxel Howind16 Jul
  • Re: Connection::connect() interface is changingAlex Burton13 Jul
    • Re: Connection::connect() interface is changingWarren Young14 Jul
  • RE: Connection::connect() interface is changingJim Wallace13 Jul
    • Re: Connection::connect() interface is changingWarren Young14 Jul