MySQL Lists are EOL. Please join:

List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:June 14 2005 6:42pm
Subject:Re: v2.0 release plan
View as plain text  
Chris Frey wrote:

> 	Connection<MysqlDriver> con;
> 	Connection<PostgreSQLDriver> con2;

I'm not sure templatizing Connection is required.  You could just add a 
parameter to the ctor:

	Connection con(new MySQLDriver, ...)

The semantic difference is that Connection has-a driver, it is not 
implemented-in-terms-of-a specific driver type.  (Connection clearly 
could be implemented in terms of a generic driver type, which implies 
inheritance, not templates.)

One benefit of my way is that you don't duplicate the code of Connection 
in the binary for each concurrent driver type you use.

Another benefit is that a program could switch database types without 
being rebuilt.  It could have a preference file of some sort, saying 
which database server is on this particular system.  The program would 
just pass a different DatabaseDriver subclass instance when creating the 
Connection object.

The only advantage to the template method is that you wouldn't have a 
pointer indirection when calling the driver.  But since almost every 
driver call involves a database server interaction, optimizing call 
times pointless.
v2.0 release planWarren Young11 Jun
  • Re: v2.0 release planChris Frey11 Jun
    • Re: v2.0 release planWarren Young13 Jun
      • Re: v2.0 release planChris Frey14 Jun
        • Re: v2.0 release planWarren Young14 Jun
Re: v2.0 release planWarren Young13 Jun