db
1<?php
2
3namespace Upside\Db\SQL;
4
5use Upside\Db\Connection;
6
7class Delete extends DeleteStatement
8{
9protected Connection $connection;
10
11public function __construct(Connection $connection, array|string $from, ?SQLStatement $statement = null)
12{
13parent::__construct($from, $statement);
14
15$this->connection = $connection;
16}
17
18/**
19* Delete records
20*
21* @return int
22*/
23public function delete(string|array $tables = [])
24{
25parent::delete($tables);
26$compiler = $this->connection->get_compiler();
27
28return $this->connection->count($compiler->delete($this->sql), $compiler->get_params());
29}
30}
31