Contact Mails

This commit is contained in:
2021-04-09 16:05:36 +02:00
parent 2ae209f53b
commit 779550cab4
17 changed files with 324 additions and 59 deletions

View File

@@ -59,7 +59,7 @@ class AlterTable extends Query {
public function getConstraint(): ?Constraint { return $this->constraint; }
public function getTable(): string { return $this->table; }
public function build(array &$params, Query $context = NULL): ?string {
public function build(array &$params): ?string {
$tableName = $this->sql->tableName($this->getTable());
$action = $this->getAction();
$column = $this->getColumn();

View File

@@ -36,7 +36,7 @@ class CreateProcedure extends Query {
return $this;
}
public function build(array &$params, Query $context = NULL): ?string {
public function build(array &$params): ?string {
$head = $this->sql->getProcedureHead($this);
$body = $this->sql->getProcedureBody($this);
$tail = $this->sql->getProcedureTail();

View File

@@ -61,7 +61,7 @@ class CreateTrigger extends Query {
public function getTable(): string { return $this->tableName; }
public function getProcedure(): CreateProcedure { return $this->procedure; }
public function build(array &$params, Query $context = NULL): ?string {
public function build(array &$params): ?string {
$name = $this->sql->tableName($this->getName());
$time = $this->getTime();
$event = $this->getEvent();

View File

@@ -24,7 +24,7 @@ class Delete extends Query {
public function getTable(): string { return $this->table; }
public function getConditions(): array { return $this->conditions; }
public function build(array &$params, Query $context = NULL): ?string {
public function build(array &$params): ?string {
$table = $this->sql->tableName($this->getTable());
$where = $this->sql->getWhereClause($this->getConditions(), $params);
return "DELETE FROM $table$where";

View File

@@ -23,7 +23,7 @@ class Drop extends Query {
return $this->table;
}
public function build(array &$params, Query $context = NULL): ?string {
public function build(array &$params): ?string {
return "DROP TABLE " . $this->sql->tableName($this->getTable());
}
}

View File

@@ -43,7 +43,7 @@ class Insert extends Query {
public function onDuplicateKey(): ?Strategy { return $this->onDuplicateKey; }
public function getReturning(): ?string { return $this->returning; }
public function build(array &$params, Query $context = NULL): ?string {
public function build(array &$params): ?string {
$tableName = $this->sql->tableName($this->getTableName());
$columns = $this->getColumns();
$rows = $this->getRows();

View File

@@ -24,4 +24,6 @@ abstract class Query extends Expression {
public function execute() {
return $this->sql->executeQuery($this);
}
public abstract function build(array &$params): ?string;
}

View File

@@ -95,7 +95,7 @@ class Select extends Query {
public function getOffset(): int { return $this->offset; }
public function getGroupBy(): array { return $this->groupColumns; }
public function build(array &$params, Query $context = NULL): ?string {
public function build(array &$params): ?string {
$columns = $this->sql->columnName($this->getColumns());
$tables = $this->getTables();

View File

@@ -15,7 +15,7 @@ class Truncate extends Query {
public function getTable(): string { return $this->tableName; }
public function build(array &$params, Query $context = NULL): ?string {
public function build(array &$params): ?string {
return "TRUNCATE " . $this->sql->tableName($this->getTable());
}
}

View File

@@ -32,7 +32,7 @@ class Update extends Query {
public function getConditions(): array { return $this->conditions; }
public function getValues(): array { return $this->values; }
public function build(array &$params, Query $context = NULL): ?string {
public function build(array &$params): ?string {
$table = $this->sql->tableName($this->getTable());
$valueStr = array();

View File

@@ -315,6 +315,8 @@ abstract class SQL {
protected function createExpression(Expression $exp, array &$params) {
if ($exp instanceof Column) {
return $this->columnName($exp);
} else if ($exp instanceof Query) {
return "(" . $exp->build($params) . ")";
} else {
$this->lastError = "Unsupported expression type: " . get_class($exp);
return null;