Adds succesfull lts/proxies migration & testsuite
This commit is contained in:
59 files changed
+754
-273
No files matched your search
@@ -50,7 +50,7 @@ DatabaseInterfaceImpl::DatabaseInterfaceImpl(int exerciseId)
|
||||
, m_bEmitMessageOnError(true)
|
||||
, m_bCanHandleSchemas(true)
|
||||
, m_ownDatabaseConnection(true)
|
||||
, m_logger(getLogger("Db"))
|
||||
, m_logger(&getLogger("Db"))
|
||||
{}
|
||||
|
||||
DatabaseInterfaceImpl::~DatabaseInterfaceImpl()
|
||||
@@ -83,7 +83,7 @@ bool DatabaseInterfaceImpl::init(const QString &dbUser,
|
||||
{
|
||||
m_ownDatabaseConnection = true;
|
||||
|
||||
m_dbConnection = DBConnection::open(m_logger, dbUser, dbPasswd, dbDriver, dbHost, dbName, schemaName());
|
||||
m_dbConnection = DBConnection::open(*m_logger, dbUser, dbPasswd, dbDriver, dbHost, dbName, schemaName());
|
||||
|
||||
return initInternal();
|
||||
}
|
||||
@@ -93,15 +93,15 @@ bool DatabaseInterfaceImpl::initInternal()
|
||||
QSqlDriver *driver = m_dbConnection.driver();
|
||||
if (!driver)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "No SQL driver loaded - no database available!";
|
||||
WARNING_LOG(*m_logger) << "No SQL driver loaded - no database available!";
|
||||
return false;
|
||||
}
|
||||
const QString driverName = m_dbConnection.driverName();
|
||||
DEBUG_LOG(m_logger) << "Connected to database " << m_dbConnection.databaseName() << "@" << m_dbConnection.hostName()
|
||||
DEBUG_LOG(*m_logger) << "Connected to database " << m_dbConnection.databaseName() << "@" << m_dbConnection.hostName()
|
||||
<< ", schema: " << schemaName() << ", used driver: " << driverName;
|
||||
if (!m_dbConnection.isOpen())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Database connection is no open - can not initialize database interface";
|
||||
WARNING_LOG(*m_logger) << "Database connection is no open - can not initialize database interface";
|
||||
return false;
|
||||
}
|
||||
if (driverName == QLatin1String("QSQLITE"))
|
||||
@@ -110,7 +110,7 @@ bool DatabaseInterfaceImpl::initInternal()
|
||||
{% if has_db_notifications %}
|
||||
if (!driver->hasFeature(QSqlDriver::EventNotifications))
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Can not subscribe to notifications - sqldriver does not support this feature!";
|
||||
WARNING_LOG(*m_logger) << "Can not subscribe to notifications - sqldriver does not support this feature!";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -120,7 +120,7 @@ bool DatabaseInterfaceImpl::initInternal()
|
||||
driver->subscribeToNotification(QStringLiteral("{{ db_notify }}"));{% endfor %}{% endfor %}
|
||||
}
|
||||
{% endif %}
|
||||
m_query = std::unique_ptr<NSqlQuery>(new NSqlQuery(m_dbConnection, m_logger));
|
||||
m_query = std::unique_ptr<NSqlQuery>(new NSqlQuery(m_dbConnection, *m_logger));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ QSqlError DatabaseInterfaceImpl::getLastError() const
|
||||
{% if has_db_notifications %}
|
||||
void DatabaseInterfaceImpl::onNotification(const QString &name, QSqlDriver::NotificationSource source, const QVariant &payload)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Notification source = " << source;
|
||||
DEBUG_LOG(*m_logger) << "Notification source = " << source;
|
||||
// no need to emit notification signals
|
||||
if (source == QSqlDriver::SelfSource)
|
||||
return;
|
||||
@@ -561,7 +561,7 @@ bool DatabaseInterfaceImpl::selectBy{{ fk.cppMemberNameCc }}(QVector<Database::{
|
||||
SqlQueryJanitor janitor(m_query);
|
||||
if (!selectPrepareInternal{{ cpp_struct.name }}(QStringLiteral(" WHERE {{ fk.dbColumnName }} = :{{ fk.dbColumnName }}") + orderBy))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error preparing query: " << m_query->lastError().text();
|
||||
ERROR_LOG(*m_logger) << "Error preparing query: " << m_query->lastError().text();
|
||||
m_lastError = m_query->lastError();
|
||||
return false;
|
||||
}
|
||||
@@ -578,7 +578,7 @@ bool DatabaseInterfaceImpl::selectBy{{ fk.cppMemberNameCc }}(const std::function
|
||||
SqlQueryJanitor janitor(m_query);
|
||||
if (!selectPrepareInternal{{ cpp_struct.name }}(QStringLiteral(" WHERE {{ fk.dbColumnName }} = :{{ fk.dbColumnName }}") + orderBy))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error preparing query: " << m_query->lastError().text();
|
||||
ERROR_LOG(*m_logger) << "Error preparing query: " << m_query->lastError().text();
|
||||
m_lastError = m_query->lastError();
|
||||
return false;
|
||||
}
|
||||
@@ -658,7 +658,7 @@ bool DatabaseInterfaceImpl::remove{{ cpp_struct.nameCc }}By{{ fk.cppMemberNameCc
|
||||
|
||||
if (!m_query->prepare(stmt))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error preparing query: " << m_query->lastError().text();
|
||||
ERROR_LOG(*m_logger) << "Error preparing query: " << m_query->lastError().text();
|
||||
m_lastError = m_query->lastError();
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user