tgrj/tweb_db

minimalistic db handler

Maintainers

Package info

codeberg.org/tgrj/tweb_db

pkg:composer/tgrj/tweb_db

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

v0.0.1 2026-03-03 21:21 UTC

This package is auto-updated.

Last update: 2026-03-03 21:23:32 UTC


README

minimalistic db handler

Idea

It's no database abstraction framework or so. It's rather some kind of wrapper for some PHP functions and some pre-defined functions doing some very basic database work. The usage of the database later in the project will get the PDO from this module and use it for further actual database handling.

Usage

  • tweb_get_pdo(string $config_key = 'db')
    • $config_key is a tweb_config key, under which the db array config is stored. it should at least contain the key type, which is either sqlite or mysql. For the first one the config array should also contain file. For mysql it should contain host, dbname, username, password. The function will return a PDO instance on success, or throw an exception otherwise.
  • tweb_execute_sql_file(\PDO $pdo, string $sql_file)
    • With that function you can execute SQL code from the given file.