// Copyright (c) 2010 Martin Knafve / hMailServer.com. // http://www.hmailserver.com #include "stdafx.h" #include "DALConnectionFactory.h" #include "ADOConnection.h" #include "MySQLConnection.h" #include "PGConnection.h" #include "SQLCEConnection.h" #include "DatabaseSettings.h" #ifdef _DEBUG #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) #define new DEBUG_NEW #endif namespace HM { DALConnectionFactory::DALConnectionFactory() { } DALConnectionFactory::~DALConnectionFactory() { } std::shared_ptr DALConnectionFactory::CreateConnection(std::shared_ptr pSettings) { std::shared_ptr pConn; HM::DatabaseSettings::SQLDBType t = pSettings->GetType(); switch (t) { case HM::DatabaseSettings::TypeMSSQLServer: pConn = std::shared_ptr(new ADOConnection(pSettings)); break; case HM::DatabaseSettings::TypeMYSQLServer: pConn = std::shared_ptr(new MySQLConnection(pSettings)); break; case HM::DatabaseSettings::TypePGServer: pConn = std::shared_ptr(new PGConnection(pSettings)); break; case HM::DatabaseSettings::TypeMSSQLCompactEdition: pConn = std::shared_ptr(new SQLCEConnection(pSettings)); break; } return pConn; } }