Files
qt-migration-legatus/qt5-before/dlbo/Lts/Common/CodeGen/svc_dao.h.grantlee
T
torstenandCopilot 7173785915 Qt6 Migration: Complete migration with DDS/RTI support and build validation
Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list

Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF

Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
  - Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
  - Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)

Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified

Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-15 18:20:26 +00:00

83 lines
2.5 KiB
Plaintext

/**
* @RDE_HEADER@
* Template for 'real' structures including insert/update/delete functions for db
* $Id: svc_db_impl.h.grantlee 53676 2021-06-10 10:21:06Z diers $
* $HeadURL: svn://192.168.133.21/TDS/branches/product/features/25_02_refactoring/Lts/Common/CodeGen/svc_db_impl.h.grantlee $
* $Author: diers $
*/
{% autoescape off %}
// filename: {{ namespace_abbr }}_dao.h
#pragma once
#include <QPointF>
#include <QString>
#include <QVector>
#include <QSqlDriver>
#include <QSqlDatabase>
#include <QtSql/QSqlError>
#include <{{ include_prefix }}/{{ namespace_abbr }}_enums.hpp>
#include <{{ include_prefix }}/{{ namespace_abbr }}_db.h>
#include <{{ include_prefix }}/logger.h>
class NSqlQuery;
namespace {{ namespace }}
{
class {{ namespace_abbr_upper }}_COMMON_EXPORT Dao {% if not custom_db_procs %}final {%endif %}: public QObject
{
Q_OBJECT
public:
explicit Dao(int exerciseId);
~Dao();
bool init(const QString &dbUser,
const QString &dbPasswd,
const QString &dbDriver,
const QString &dbHost,
const QString &dbName);
QString schemaName() const;
QString dbUser() const;
const QSqlDatabase &database() const { return m_dbConnection; }
void setEmitMessageOnError(bool bEmit);
QSqlError getLastError() const;
{% for cpp_struct in cpp_structs %}
// --> Database::{{ cpp_struct.name }}
public:
bool select(QVector<Database::{{ cpp_struct.name }}> &dataVec, const QString &where = QString());
private:
bool selectPrepareInternal{{ cpp_struct.name }}(const QString &where);
bool selectFetchInternal{{ cpp_struct.name }}(const std::function<void(const Database::{{ cpp_struct.name }} &data)> &cb);
// <-- Database::{{ cpp_struct.name }}
{% endfor %}
static QString qVariantToJsonString(const QVariant &value);
protected:
QString getTableName(const QString &tableName) const;
{% if has_db_notifications %}
private Q_SLOTS:
void onNotification(const QString &name, QSqlDriver::NotificationSource source, const QVariant &payload);
Q_SIGNALS:
{% for cpp_struct in cpp_structs %}{% for db_notify in cpp_struct.dbNotifications %} void signal{{ db_notify }}(int id);
{% endfor %}{% endfor %}{% endif %}
protected:
QSqlDatabase m_dbConnection;
std::unique_ptr<NSqlQuery> m_query;
QSqlError m_lastError;
int m_exerciseId;
bool m_bEmitMessageOnError;
bool m_bCanHandleSchemas;
bool m_ownDatabaseConnection;
LOGGER_T m_logger;
private:
bool initInternal();
};// class Dao
} // namespace {{ namespace }}
{% endautoescape %}