Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ConnectionParameters.h"
- using namespace Atm::DbProvider;
- ConnectionParameters ConnectionParameters::fromSqlDatabase( const QSqlDatabase & database )
- {
- return { database.driverName(), database.hostName(), (quint16)database.port(),
- database.databaseName(), database.userName(), database.password() };
- }
- QSqlDatabase ConnectionParameters::createSqlDatabase( const QString & connectionName ) const
- {
- QSqlDatabase db = QSqlDatabase::addDatabase( driver, connectionName );
- db.setHostName( hostName );
- db.setPort( port );
- db.setDatabaseName( databaseName );
- db.setUserName( userName );
- db.setPassword( password );
- return db;
- }
- bool Atm::DbProvider::ConnectionParameters::operator==( const ConnectionParameters & other ) const
- {
- return driver == other.driver && hostName == other.hostName && port == other.port
- && databaseName == other.databaseName && userName == other.userName && password == other.password;
- }
- bool Atm::DbProvider::ConnectionParameters::operator!=( const ConnectionParameters & other ) const
- {
- return !( *this == other );
- }
Add Comment
Please, Sign In to add comment