web-base/Core/Driver/SQL/Query/Delete.class.php
2022-11-30 16:42:24 +01:00

24 lines
513 B
PHP

<?php
namespace Core\Driver\SQL\Query;
use Core\Driver\SQL\SQL;
class Delete extends ConditionalQuery {
private string $table;
public function __construct(SQL $sql, string $table) {
parent::__construct($sql);
$this->table = $table;
}
public function getTable(): string { return $this->table; }
public function build(array &$params): ?string {
$table = $this->sql->tableName($this->getTable());
$where = $this->getWhereClause($params);
return "DELETE FROM $table$where";
}
}