{"id":26496899,"url":"https://github.com/zheng-bote/cxx-cli_db-exec","last_synced_at":"2026-05-11T02:40:41.593Z","repository":{"id":282083221,"uuid":"947430379","full_name":"Zheng-Bote/cxx-cli_db-exec","owner":"Zheng-Bote","description":"command line tool to execute sql in an ordered manner","archived":false,"fork":false,"pushed_at":"2025-03-19T18:11:21.000Z","size":537,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-19T19:21:47.202Z","etag":null,"topics":["cpp23","database","linux-shell","sql"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Zheng-Bote.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-12T17:14:15.000Z","updated_at":"2025-03-19T18:11:26.000Z","dependencies_parsed_at":"2025-03-12T18:43:24.978Z","dependency_job_id":null,"html_url":"https://github.com/Zheng-Bote/cxx-cli_db-exec","commit_stats":null,"previous_names":["zheng-bote/cxx-cli_db-exec"],"tags_count":0,"template":false,"template_full_name":"Zheng-Bote/repo-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zheng-Bote%2Fcxx-cli_db-exec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zheng-Bote%2Fcxx-cli_db-exec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zheng-Bote%2Fcxx-cli_db-exec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zheng-Bote%2Fcxx-cli_db-exec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zheng-Bote","download_url":"https://codeload.github.com/Zheng-Bote/cxx-cli_db-exec/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244618417,"owners_count":20482316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp23","database","linux-shell","sql"],"created_at":"2025-03-20T13:00:01.870Z","updated_at":"2026-05-11T02:40:41.588Z","avatar_url":"https://github.com/Zheng-Bote.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv id=\"top\" align=\"center\"\u003e\n\u003ch1\u003ecxx-cli_db-exec\u003c/h1\u003e\n\n\u003cp\u003ecommand line tool to execute sql in an ordered manner\u003c/p\u003e\n\n[Report Issue](https://github.com/Zheng-Bote/cxx-cli_db-exec/issues) [Request Feature](https://github.com/Zheng-Bote/cxx-cli_db-exec/pulls)\n\n[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/Zheng-Bote/cxx-cli_db-exec?logo=GitHub)](https://github.com/Zheng-Bote/cxx-cli_db-exec/releases)\n\n\u003c/div\u003e\n\n\u003chr\u003e\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n**Table of Contents**\n\n- [Description](#description)\n  - [Features](#features)\n- [Status](#status)\n- [Documentation](#documentation)\n  - [Architecture](#architecture)\n  - [Usage](#usage)\n    - [Example](#example)\n      - [example DB system ini](#example-db-system-ini)\n      - [example DB sql ini](#example-db-sql-ini)\n- [Installation](#installation)\n  - [Dependencies](#dependencies)\n    - [Conan](#conan)\n    - [CMake](#cmake)\n    - [Doxygen](#doxygen)\n      - [Doxygen Awesome](#doxygen-awesome)\n    - [cxxopts](#cxxopts)\n    - [inifile-cpp](#inifile-cpp)\n    - [plog](#plog)\n    - [PQXX_LIB](#pqxx_lib)\n  - [folder structure](#folder-structure)\n- [Authors and License](#authors-and-license)\n  - [License](#license)\n  - [Authors](#authors)\n    - [Code Contributors](#code-contributors)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n\u003chr\u003e\n\n# Description\n\n![CXX](https://img.shields.io/badge/C++-23-blue?logo=cplusplus)\n![GHA](https://img.shields.io/badge/Github-Action-black?logo=githubactions)\n\ncommand line tool to execute sql in an ordered way.\n\n## Features\n\n- \\[ ] advanced-super-extra-special feature xyz\n\n  \u003cbr\u003e\n\n- \\[x] OSS and license\n- \\[x] works as designed\n- \\[ ] no bugs\n\n\u003cbr\u003e\n\n- \\[x] some more or less usefull Github Actions for GH-repo, GH-pages, GH-wiki, CI/CD-Pipelines\n- \\[x] Packagemanager (CPack)\n- \\[x] Installation routine (IFW;DEB;ZIP;TBZ2;RPM)\n- \\[ ] portable application\n- \\[x] logrotation included (100KiB)\n\n\u003cbr\u003e\n\n- \\[ ] runs on DOS/Windows\n- \\[ ] runs on MacOS\n- \\[x] runs on Linux\n- \\[ ] runs on iOS\n- \\[ ] runs on Android\n- \\[ ] runs on HarmonyOS\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n# Status\n\n![GitHub Created At](https://img.shields.io/github/created-at/Zheng-Bote/cxx-cli_db-exec)\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/Zheng-Bote/cxx-cli_db-exec?logo=GitHub)](https://github.com/Zheng-Bote/cxx-cli_db-exec/releases)\n![GitHub Release Date](https://img.shields.io/github/release-date/Zheng-Bote/cxx-cli_db-exec)\n![Status](https://img.shields.io/badge/Status-stable-green)\n![Status](https://img.shields.io/badge/Status-works_as_designed-green)\n\n![GitHub Issues](https://img.shields.io/github/issues/Zheng-Bote/cxx-cli_db-exec)\n![GitHub Pull Requests](https://img.shields.io/github/issues-pr/Zheng-Bote/cxx-cli_db-exec)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n# Documentation\n\n- DB connections for different environments are managed in an (db system) Inifile (e.g.: dev, test, int, prod)\n- SQL are defined in an (db sql) Inifile, divided into sections\n  - each section has an `active`-attribute so the section can be de-activated\n  - each section has a `type`-definition (e.g.: schema, fdw, db-links, triggers)\n  - each section has an `id` so sections with same `type`-definition will be sorted ascending for execution\n  - each section has an attribute `sql_string` which will be executed in this section first\n  - each section has an attribute `sql_file` which will executed in this section as second (the sql-file will be parsed and each sql-statement within this file will be executed)\n  - each section has an attribute `sql_path` which will executed in this section as third (all sql-files in the defined folder, starting with `\u003cnumber\u003e_\u003cfilename\u003e.sql` will be sorted ascending, parsed and each sql-statement within this file will be executed). SQL-files in this folder without prefix `\u003cnumber\u003e_` will be ignored.\n\n\u003e \\[!WARNING]\n\u003e please keep in mind about case sensitivity\n\n\u003e \\[!CAUTION]\n\u003e it's highly recommended to encrypt your DB system Inifile.\\\n\u003e Encrypt before upload to Git repository\\\n\u003e Decrypt before using and encrypt after using\\\n\u003e _see also:_ [qt-cli_file_encryption-decryption](https://github.com/Zheng-Bote/qt-cli_file_encryption-decryption)\n\n## Architecture\n\nThis project provides comprehensive architectural insights described in multiple UML and diagrammatic views (Bounded Context, Sequences, State Machines, Components, etc.) generated with Mermaid JS.\n\nFor a summary and detailed diagrams representing the structural and behavioral design of `cxx-cli_db-exec`, please see the [Architecture Documentation Directory](./docs/architecture/README.md).\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n## Usage\n\n```bash\nDB deployments\ncommand line tool to execute sql in an ordered manner\nUsage:\n  db_deploy [OPTION...]\n\n  -c, --connect arg  \u003cpath/to/db_system.ini\u003e with DB connect data\n  -d, --debug        optional: run logging in debug mode\n  -e, --env arg      environment to use, e.g.: dev, int, prod\n  -s, --sql arg      \u003cpath/to/sql.ini\u003e with sql instructions\n  -t, --type arg     which type in sql.ini to work on, e.g.: schema, db-links\n  -v                 print program version and exit\n      --version      print program information and exit\n  -h, --help         Print help and exit\n```\n\n### Example\n\nrun the tool and deploy schema definitions in dev environment\n\n```cli\n./db_deploy -c /iac/photo_gallery/db/db_system.ini -s /iac/photo_gallery/db/deploy/db_sql.ini --env dev --type schema\n```\n\n#### example DB system ini\n\n\u003e \\[!CAUTION]\n\u003e it's highly recommended to encrypt your DB system Inifile.\\\n\u003e Encrypt before upload to Git repository\\\n\u003e Decrypt before using and encrypt after using\\\n\u003e _see also:_ [qt-cli_file_encryption-decryption](https://github.com/Zheng-Bote/qt-cli_file_encryption-decryption)\n\n```ini\n[dev]\nid=0\ntype=system\ndbname=photo_gallery\nhostname=192.168.178.19\npassword=IchBinRoot\nport=1111\nusername=postgres\nuse_proxy=false\ndb_proxy=\ndb_proxy_port=\nlogfile_path=/tmp\n\n[test]\nid=1\ntype=system\ndbname=t_photo_gallery\nhostname=192.168.178.19\npassword=photo_gallery\nport=1112\nusername=photo_gallery\nuse_proxy=false\ndb_proxy=\ndb_proxy_port=\nlogfile_path=/tmp/\n\n[int]\nid=2\ntype=system\ndbname=i_photo_gallery\nhostname=\npassword=Top$ecret?\nport=\nusername=master\nuse_proxy=true\ndb_proxy=dbproxy-li52y.eu-central-1.aws.cloud\ndb_proxy_port=5555\nlogfile_path=/var/log/\n\n[prod]\nid=3\ntype=system\ndbname=p_photo_gallery\nhostname=\npassword=2hot4U!\nport=\nusername=master\nuse_proxy=true\ndb_proxy=dbproxy-mh81h.eu-central-1.aws.cloud\ndb_proxy_port=8888\nlogfile_path=/var/log/\n```\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n#### example DB sql ini\n\n\u003e \\[!WARNING]\n\u003e please keep in mind about case sensitivity\n\n```ini\n[tab1]\nid=1\ntype=schema\nname=base\nactive=true\nsql_string=CREATE TABLE IF NOT EXISTS test_users (id INT PRIMARY KEY, name VARCHAR(100));\nsql_file=./sql/schemas/base/base_starter.sql\nsql_path=./sql/schemas/base\n\n[othertab2]\nid=1\ntype=trigger\nname=triggers\nactive=true\nsql_string=\nsql_file=./sql/schemas/trigger/trigger_starter.sql\nsql_path=\n\n[notab3]\nid=2\ntype=schema\nname=base_extended\nactive=true\nsql_string=\nsql_file=\nsql_path=./sql/schemas/\n\n[betab4]\nid=5\ntype=fdw\nname=foreign_data_wrapper\nactive=false\nsql_string=CREATE USER MAPPING FOR master SERVER geoapi  OPTIONS (user 'apiuser', password 'admin1234');\nsql_file=#./sql/schemas/fdw/geoapi.sql\nsql_path=\n\n[istab5]\nid=3\ntype=data\nname=test_data\nactive=true\nsql_string=INSERT INTO photo_location(id,continent, country, country_code, province, city, district) VALUES (10,'EU', 'Germoney', 'de', 'Bavaria', 'Munich', 'gma');\nsql_file=\nsql_path=./sql/data/photo_gallery\n\n[mytab6]\nid=3\ntype=schema\nname=mytable3\nactive=false\nsql_string=\nsql_file=./test/create_table.sql\nsql_path=\n\n[othername]\nid=39\ntype=schema\nname=mytable3\nactive=false\nsql_string=\nsql_file=\nsql_path=#./test\n\n[dotab8]\nid=23\ntype=schema\nname=mytable3\nactive=false\nsql_string=\nsql_file=\nsql_path=./schemas\n```\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n# Installation\n\nSeveral installation packages are available, depending on your Linux system (deb, rpm, zip, AppImage).\n\n\u003e \\[!NOTE]\n\u003e see (latest) Release for packages\n\n## Dependencies\n\n\u003e \\[!NOTE]\n\u003e All licenses are therefore Open Source.\n\n### Conan\n\nConan, software package manager for C and C++ developers\n\n[![Conan](https://img.shields.io/badge/Conan-v2+-6699CB?logo=conan)](https://github.com/conan-io/conan)\n[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)\n\n### CMake\n\nCMake: A Powerful Software Build System\n\n[![CMake](https://img.shields.io/badge/CMake-v3.23+-064F8C?logo=cmake)](https://github.com/conan-io/conan)\n[![BSD-3 License](https://img.shields.io/badge/License-BSD_3-green.svg)](https://choosealicense.com/licenses/bsd-3-clause/)\n\n### Doxygen\n\nCode Documentation. Automated.\n\n[![Doxygen](https://img.shields.io/badge/Doxygen-v1.12+-2C4AA8?logo=doxygen)](https://github.com/doxygen/doxygen)\n[![GPL-2 License](https://img.shields.io/badge/License-GPL_2-green.svg)](https://choosealicense.com/licenses/gpl-2.0/)\n\n#### Doxygen Awesome\n\nDoxygen Awesome is a custom CSS theme for Doxygen HTML documentation.\n\nThis theme is an attempt to update the visuals of Doxygen without changing its overall layout too much.\n\n[![Doxygen Awesome](https://img.shields.io/badge/Doxygen_Awesome-v2.3.3-2C4AA8?logo=doxygen)](https://github.com/jothepro/doxygen-awesome-css)\n[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)\n\n### cxxopts\n\na lightweight C++ option parser library, supporting the standard GNU style syntax for options.\n\n[![jarro2783](https://img.shields.io/badge/Github-jarro2783-black?logo=github)](https://github.com/jarro2783/cxxopts)\n[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)\n\n\u003e \\[!NOTE]\n\u003e managed via the package manager [![Conan Center](https://img.shields.io/conan/v/cxxopts)](https://conan.io/center/recipes/cxxopts)\n\n### inifile-cpp\n\ninifile-cpp is a simple and easy to use single header-only ini file en- and decoder for C++.\n\n[![Fabian Meyer](https://img.shields.io/badge/Github-Fabian_Meyer-black?logo=github)](https://github.com/Rookfighter/inifile-cpp)\n[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)\n\n\u003e \\[!NOTE]\n\u003e included in `src/includes`\n\n### plog\n\nPlog - portable, simple and extensible C++ logging library\n\n[![Sergey Podobry](https://img.shields.io/badge/Github-Sergey_Podobry-black?logo=github)](https://github.com/SergiusTheBest/plog)\n[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)\n\n\u003e \\[!NOTE]\n\u003e managed via the package manager [![Conan Center](https://img.shields.io/conan/v/plog)](https://conan.io/center/recipes/plog)\n\n### PQXX_LIB\n\n__tbd__\n\n## folder structure\n\n\u003c!-- readme-tree start --\u003e\n```\n.\n├── .github\n│   ├── actions\n│   │   └── doctoc\n│   │       ├── README.md\n│   │       ├── action.yml\n│   │       └── dist\n│   │           ├── index.js\n│   │           ├── index.js.map\n│   │           ├── licenses.txt\n│   │           └── sourcemap-register.js\n│   └── workflows\n│       ├── ghp-call_Readme.yml\n│       ├── ghp-create_doctoc.yml\n│       ├── ghp-markdown_index.yml\n│       ├── repo-actions_docu.yml\n│       ├── repo-call_Readme.yml\n│       ├── repo-create_doctoc.yml_\n│       ├── repo-create_doctoc_md.yml\n│       └── repo-create_tree_readme.yml\n├── .gitignore\n├── LICENSE\n├── README.md\n├── do_compile.sh\n├── docs\n│   ├── .gitkeep\n│   ├── architecture\n│   │   ├── 01_overview.md\n│   │   ├── 02_class_diagram.md\n│   │   ├── 03_sequence_diagram.md\n│   │   ├── 04_component_diagram.md\n│   │   ├── 05_deployment_diagram.md\n│   │   ├── 06_use_case_diagram.md\n│   │   ├── 07_activity_diagram.md\n│   │   ├── 08_state_machine_diagram.md\n│   │   ├── 09_timing_diagram.md\n│   │   ├── 10_interaction_overview_diagram.md\n│   │   ├── 11_communication_diagram.md\n│   │   ├── 12_object_diagram.md\n│   │   ├── 13_package_diagram.md\n│   │   ├── 14_profile_diagram.md\n│   │   └── README.md\n│   └── img\n│       └── console_logs.png\n├── src\n│   ├── CMakeLists.txt\n│   ├── conanfile.txt\n│   ├── configure\n│   │   ├── ClangTidy.cmake\n│   │   ├── Doxygen.cmake\n│   │   ├── extra_headers\n│   │   └── rz_config.h.in\n│   ├── includes\n│   │   ├── dotenv.h\n│   │   ├── inicpp.h\n│   │   ├── rz_config.h\n│   │   ├── rz_db.h\n│   │   ├── rz_fs.cpp\n│   │   ├── rz_fs.h\n│   │   ├── rz_inifile.cpp\n│   │   ├── rz_inifile.h\n│   │   ├── rz_logpath.h\n│   │   ├── rz_options.h\n│   │   ├── rz_parse_sqlfile.h\n│   │   ├── rz_snippets.cpp\n│   │   ├── rz_snippets.h\n│   │   └── rz_strings.h\n│   └── main.cpp\n└── tree.bak\n\n12 directories, 57 files\n```\n\u003c!-- readme-tree end --\u003e\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n# Authors and License\n\n## License\n\n[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)\n\nCopyright (c) 2025 ZHENG Robert\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n        https://choosealicense.com/licenses/mit/\n\n## Authors\n\n- [![Zheng Robert](https://img.shields.io/badge/Github-Zheng_Robert-black?logo=github)](https://www.github.com/Zheng-Bote)\n\n### Code Contributors\n\n![Contributors](https://img.shields.io/github/contributors/Zheng-Bote/cxx-cli_db-exec?color=dark-green)\n\n[![Zheng Robert](https://img.shields.io/badge/Github-Zheng_Robert-black?logo=github)](https://www.github.com/Zheng-Bote)\n\n\u003chr\u003e\n\n:vulcan_salute:\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzheng-bote%2Fcxx-cli_db-exec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzheng-bote%2Fcxx-cli_db-exec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzheng-bote%2Fcxx-cli_db-exec/lists"}