You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.1 KiB

<?php
namespace App\Wrappers;
use App\Common\DateTimeHandling;
use App\Common\ErrorPayloadRendering;
use Aura\SqlQuery\Common\DeleteInterface;
use Aura\SqlQuery\QueryFactory;
use DateTime;
class SQLQueryBuilderWrapper
{
public static function SELECT(string $table)
{
$query_factory = new QueryFactory(db: 'mysql');
$query = $query_factory->newSelect()
->from("$table AS T")
;
return $query
->cols([
"T.*",
]);
}
public static function SELECT_ONE(string $table, string $id)
{
return self::SELECT(table: $table)
->where(cond: "ID=:__id__")
->bindValue(name: "__id__", value: $id)
->limit(limit: 1)
;
}
public static function SELECT_WITH_PARENT_ID(string $table, string $parentIDName, string $parentIDValue)
{
return self::SELECT(table: $table)
->where(cond: "$parentIDName=:__parent_id__")
->bindValue(name: "__parent_id__", value: $parentIDValue)
;
}
}