web-base/core/Driver/SQL/Query/Query.class.php

29 lines
571 B
PHP
Raw Normal View History

2020-04-02 00:02:51 +02:00
<?php
namespace Driver\SQL\Query;
2021-04-08 19:08:05 +02:00
use Driver\SQL\Expression\Expression;
2020-04-03 17:39:58 +02:00
use Driver\SQL\SQL;
2021-04-08 19:08:05 +02:00
abstract class Query extends Expression {
2020-04-02 00:02:51 +02:00
2020-04-03 17:39:58 +02:00
protected SQL $sql;
2020-04-04 01:15:59 +02:00
public bool $dump;
2020-04-02 00:02:51 +02:00
2021-04-02 21:58:06 +02:00
public function __construct(SQL $sql) {
2020-04-02 00:02:51 +02:00
$this->sql = $sql;
2020-04-04 01:15:59 +02:00
$this->dump = false;
}
2021-04-02 21:58:06 +02:00
public function dump(): Query {
2020-04-04 01:15:59 +02:00
$this->dump = true;
return $this;
2020-04-02 00:02:51 +02:00
}
2021-04-02 22:41:24 +02:00
// can actually return bool|array (depending on success and query type)
2021-04-08 18:29:47 +02:00
public function execute() {
return $this->sql->executeQuery($this);
}
2021-04-09 16:05:36 +02:00
public abstract function build(array &$params): ?string;
2020-04-03 17:39:58 +02:00
}