How wekers/tcc-retaguardaloja works
Project Type and Purpose
• This is a monolithic, thick-client desktop application (“Retaguarda de Loja”) developed in PowerBuilder 2022 R3.
• It exposes a rich GUI (windows, menus, DataWindow objects) and contains embedded business logic and data access code.
• It connects via ODBC to a PostgreSQL database and includes auxiliary executables for backup and auto-updates.
High-Level File Structure Analysis
• Top-level executables and project artifacts:
• RetaguardaTCC.pbw, retaguarda.pbt, Releases/… (retaguarda.exe/.pbd/.pbt/.xml + updater.exe)
• Instalador/Install_RetaguardaDeLoja.exe
• Source code directory (ws_objects/retaguarda.pbl.src & ws_objects/Backup db):
• PowerBuilder objects (.sru, .srw, .srd, .srf, .srj, .srm) organized by window, DataWindow, function, user object, menu, script.
• Database scripts (Banco de Dados/):
• DDL and DML scripts (.sql) for schema creation, seed data, truncation.
• Configuration and automation:
• ODBC Profile DB.ini, config.ini for backup, update.txt, updater.ini.
Key Components
a. Presentation Layer
• PowerBuilder Client Application
– UI Windows & Menus (w_*.srw, m_menu.srm)
– DataWindow objects (d_*.srd) for querying and binding data
– Business functions and user objects (.srf, .sru, .srj)
b. Data Access Layer
• ODBC 64-bit Driver (ODBC Profile DB.ini)
• Connection pooling, SQL execution via DataWindow retrieval objects
c. Data Store Layer
• PostgreSQL Database
– Schema and tables generated by Banco de Dados/*.sql
d. Auxiliary Services
• Backup Utility (backupdb.exe + config.ini)
• Auto-Updater (updater.exe + updater.ini + update.txt)
• Installer (Advanced Installer package)
e. Release & Deployment
• Releases folder (versioned binaries and metadata XML)
• Install_RetaguardaDeLoja.exe
Relationships and Data Flows
• The PowerBuilder client issues queries and DML via DataWindow objects → travels over ODBC → PostgreSQL.
• GUI actions (login, CRUD, reports) invoke functions in code objects → generate SQL retrievals/updates.
• Backup Utility connects directly to the DB via its own ODBC profile to dump/restore data.
• Auto-Updater checks updates/update.txt on startup or schedule → downloads new binaries from Releases → overwrites local install.
• Installer orchestrates initial deployment: places client EXE, config files, ODBC profile, and DB scripts.
Architectural Patterns & Design Principles
• Layered Monolith: Presentation & Business Logic co-located in one deployable; Data Access abstracted through DataWindow retrieval/specification objects.
• Code Organization: PB objects grouped by feature (windows, data windows, scripts), facilitating modular maintenance.
• Externalization of Configuration: INI files for database connection and backup/updater parameters.
• Versioned Releases: XML manifests accompany each binary release for metadata/patching.