44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
|
<?php
|
||
|
namespace DatabaseHelper;
|
||
|
|
||
|
use DatabaseHelper\interfaces\MigrationBlueprint;
|
||
|
use DatabaseHelper\interfaces\QueryBuilder;
|
||
|
use DatabaseHelper\interfaces\TableBlueprint;
|
||
|
use DatabaseHelper\interfaces\UpdateBuilder;
|
||
|
|
||
|
class Database implements interfaces\DatabaseHelper
|
||
|
{
|
||
|
public static function makeTable(string $tableName): TableBlueprint
|
||
|
{
|
||
|
// TODO: Implement makeTable() method.
|
||
|
}
|
||
|
|
||
|
public static function makeMigration(TableBlueprint $table): MigrationBlueprint
|
||
|
{
|
||
|
// TODO: Implement makeMigration() method.
|
||
|
}
|
||
|
|
||
|
public static function makeQuery(TableBlueprint ...$tables): QueryBuilder
|
||
|
{
|
||
|
// TODO: Implement makeQuery() method.
|
||
|
}
|
||
|
|
||
|
public static function makeInsertion(TableBlueprint ...$tables): QueryBuilder
|
||
|
{
|
||
|
// TODO: Implement makeInsertion() method.
|
||
|
}
|
||
|
|
||
|
public static function makeUpdate(TableBlueprint ...$tables): UpdateBuilder
|
||
|
{
|
||
|
// TODO: Implement makeUpdate() method.
|
||
|
}
|
||
|
|
||
|
public static function standardizeTableNames(string &...$tableName): void {
|
||
|
global $wpdb;
|
||
|
$dbPrefix = $wpdb->prefix;
|
||
|
|
||
|
foreach ($tableName as &$name)
|
||
|
if (!str_starts_with($name, $dbPrefix))
|
||
|
$name = $dbPrefix . $name;
|
||
|
}
|
||
|
}
|