Files
qt-migration-legatus/qt5-before/dlbo/Lts/Tests/DatabaseInitialisation/geister.py
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

107 lines
4.1 KiB
Python
Executable File

#!/usr/bin/env python3
import subprocess
import os
import sys
# 🔧 Verbindungseinstellungen (anpassen!)
DB_NAME = "guez_20250910"
DB_USER = "postgres"
DB_HOST = "localhost"
DB_PORT = "5432"
# 🔍 Welche Schemata durchsuchen?
SCHEMA_PREFIX = "ex\_"
TABLE_NAME = "rec_equipment_state"
# ⚙️ psql-Basisbefehl (mit -A = unaligned, -t = tuple-only)
PSQL_BASE = [
"psql",
"-h", DB_HOST,
"-p", DB_PORT,
"-U", DB_USER,
"-d", DB_NAME,
"-A", "-t", "-c"
]
def run_psql(query):
"""Führt ein SQL-Statement aus und gibt den Text-Output zurück."""
env = os.environ.copy();
process = subprocess.Popen(
PSQL_BASE + [query],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env=env,
universal_newlines=True
)
stdout, stderr = process.communicate()
if process.returncode != 0:
sys.stderr.write("Fehler bei psql: \n" + stderr + "\n")
return ""
return stdout.strip()
def main():
# 🔹 1. Schemata abrufen
print("🔍 Suche nach Schemas ...")
schema_query = f"SELECT schema_name FROM information_schema.schemata WHERE schema_name LIKE '{SCHEMA_PREFIX}%' ORDER BY schema_name;"
schema_output = run_psql(schema_query)
schemas = [s for s in schema_output.splitlines() if s.strip()]
print(f"Gefundene Schemata: {schemas}\n")
# 🔹 2. Query pro Schema ausführen
for schema in schemas:
# Anzahl verschiedener Verursacher, wenn originator_id als equipment_number betrachtet wird:
# query = f"select COUNT(*) FROM (select originator_id, COUNT(*) from {schema}.{TABLE_NAME} \
# where originator_type = 1 AND equipment_number not in \
# (select equipment_number from {schema}.rec_participant where equipment_number > 0) \
# AND position->>'reportingSource' = '3' GROUP BY originator_id)"
# Verursacher EquipmentNumbers und Anzahl an Treffern, wenn originator_id als equipment_number betrachtet wird.
query = f"select originator_id, COUNT(*) from {schema}.{TABLE_NAME} \
where originator_type = 1 AND equipment_number not in \
(select equipment_number from {schema}.rec_participant where equipment_number > 0) \
AND position->>'reportingSource' = '3' GROUP BY originator_id"
# Gesamtanzahl an Treffern, wenn originator_id als equipment_number betrachtet wird.
# query = f"select COUNT(*) from {schema}.{TABLE_NAME} \
# where originator_type = 1 AND equipment_number not in \
# (select equipment_number from {schema}.rec_participant where equipment_number > 0) \
# AND position is null"
# AND position->>'reportingSource' != '3'"
# AND position is null GROUP BY originator_id)"
# queryParticpantIdsFromEqNo = f"select id from {schema}.rec_participant where equipment_number in "
# queryUnknownExternalEqNos = f"select equipment_number from {schema}.{TABLE_NAME} WHERE equipment_number not in "
# Ausstattungsnummern aller externer Teilnehmer, die getroffen wurden:
# query = f"select equipment_number from {schema}.{TABLE_NAME} \
# where equipment_number not in \
# (select equipment_number from {schema}.rec_participant where equipment_number > 0) \
# and position->>'reportingSource' = '3'"
# and originator_type = 4 AND position is null"
# query = f"select DISTINCT equipment_number from {schema}.{TABLE_NAME} \
# where equipment_number not in \
# (select equipment_number from {schema}.rec_participant where equipment_number > 0) ORDER BY equipment_number"
# query = f"select COUNT(*) FROM (SELECT DISTINCT equipment_number from {schema}.{TABLE_NAME} \
# where equipment_number not in \
# (select equipment_number from {schema}.rec_participant where equipment_number > 0) )"
print(f"▶️ {schema}")
try:
result = run_psql(query)
if result.strip():
print(result)
else:
print("(keine Ergebnisse)\n")
except subprocess.CalledProcessError as e:
print(f"❌ Fehler bei Schema {schema}: {e.stderr}\n")
if __name__ == "__main__":
main()