50 lines
1.1 KiB
C++
Executable File
50 lines
1.1 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Custom db functions (extends tab_db_impl.cpp/.h)
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#include "evl_db_impl_custom.h"
|
|
#include <ngldb/nsqlquery.h>
|
|
#include <ngldb/sql_query_janitor.h>
|
|
#include <QRegularExpression>
|
|
|
|
namespace Evaluations
|
|
{
|
|
// custom procs, body must be implemented by user
|
|
bool DatabaseInterfaceImplCustom::removeCategoryLinesPerNineLiner(qint64 nineLinerId)
|
|
{
|
|
const QString tableName = getTableName(QStringLiteral("san_category_line"));
|
|
const QString stmt = QStringLiteral("DELETE FROM ") + tableName + QStringLiteral(" WHERE nine_liner_id = :id");
|
|
|
|
if (!m_query)
|
|
{
|
|
ERROR_LOG(m_logger) << "m_query not initialized";
|
|
return false;
|
|
}
|
|
|
|
{
|
|
SqlQueryJanitor janitor(m_query);
|
|
|
|
if (!m_query->prepare(stmt))
|
|
{
|
|
ERROR_LOG(m_logger) << "Could not prepare statement: " << stmt;
|
|
return false;
|
|
}
|
|
|
|
m_query->bindValue(QStringLiteral(":id"), nineLinerId);
|
|
|
|
if (!m_query->exec())
|
|
{
|
|
ERROR_LOG(m_logger) << "Could not execute statement: " << stmt;
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
} // query scope
|
|
}
|
|
|
|
}
|