forked from mirzaev/deeproots_bot
read database util and file cleanup
This commit is contained in:
parent
d867d640a4
commit
ced4e3241c
|
@ -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
|
||||||
*
|
*
|
||||||
|
|
|
@ -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);
|
Loading…
Reference in New Issue