read database util and file cleanup

This commit is contained in:
Little Fluffy Clouds 2025-07-10 18:08:08 +03:00
parent d867d640a4
commit ced4e3241c
5 changed files with 924 additions and 885 deletions

View File

@ -79,7 +79,7 @@ final class telegram extends core
* *
* @param model $telegram The telegram account * @param model $telegram The telegram account
* *
* @throws exception_runtime if update the telegram account record in the database by the telegram account values * @throws exception_runtime if failed to update the telegram account record in the database by the telegram account values
* @throws exception_runtime if failed to find the created telegram account * @throws exception_runtime if failed to find the created telegram account
* @throws exception_runtime if failed to create the telegram account * @throws exception_runtime if failed to create the telegram account
* *

View File

@ -10,8 +10,8 @@ use mirzaev\minimal\core,
// Enabling debugging // Enabling debugging
/* ini_set('error_reporting', E_ALL); /* ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1); ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); */ ini_set('display_startup_errors', 1); */
// Initializing path to the public directory // Initializing path to the public directory
define('INDEX', __DIR__); define('INDEX', __DIR__);
@ -43,7 +43,7 @@ $core = new core(namespace: __NAMESPACE__);
// Initializing routes // Initializing routes
$core->router $core->router
->write('/', new route('index', 'index'), 'GET') ->write('/', new route('index', 'index'), 'GET')
; ;
// Handling request // Handling request
$core->start(); $core->start();

View File

@ -20,8 +20,8 @@ use Zanzara\Zanzara as zanzara,
// Enabling debugging // Enabling debugging
/* ini_set('error_reporting', E_ALL); /* ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1); ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); */ ini_set('display_startup_errors', 1); */
// Initializing path to the public directory // Initializing path to the public directory
define('INDEX', __DIR__); define('INDEX', __DIR__);

View File

@ -0,0 +1,39 @@
<?php
use mirzaev\baza\database,
mirzaev\baza\column,
mirzaev\baza\record,
mirzaev\baza\enumerations\encoding,
mirzaev\baza\enumerations\type;
// Initializing path constants
define('INDEX', __DIR__);
define('ROOT', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
define('SETTINGS', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'settings');
define('DATABASES', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'databases');
// Initializing dependencies and system settings
require ROOT . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
require SETTINGS . DIRECTORY_SEPARATOR . 'system.php';
// Initializing a path to the Baza database binary file
$file = DATABASES . DIRECTORY_SEPARATOR . 'telegram.baza';
// Instanciating new database class we want to read
$database = new database()
->encoding(encoding::utf8)
->columns(
new column('identifier', type::integer_unsigned),
new column('domain', type::string, ['length' => 32]),
new column('name_first', type::string, ['length' => 64]),
new column('name_second', type::string, ['length' => 64]),
new column('language', type::string, ['length' => 2]),
new column('robot', type::char),
new column('updated', type::integer_unsigned),
new column('created', type::integer_unsigned)
)
->connect($file);
// Reading the whole database array
$read = $database->read();
print_r($read);