public function build(Breakdown $bk, $tabs) { $doWhere = true; /** @var Condition $condition */ foreach ($this->conditions as $condition) { if ($doWhere) { $bk->line($tabs + 1); $bk->append(" {$this->keyword}"); $doWhere = false; } else { $bk->line($tabs + 1); $bk->append(" " . $condition->connector()); } $condition->build($bk, $tabs); } }
public function build(Breakdown $bk, $tabs) { $bk->line($tabs + 2); $bk->append(" " . $this->column1); if ($this->column2) { $bk->append(" = "); $bk->append(" " . $this->column2); } }
public function build(Breakdown $bk, $tabs) { $bk->line($tabs + 1); $bk->append(" INTO"); $bk->append(" " . $this->table); if ($this->columns != null) { $bk->append(' ('); $bk->append(implode(', ', $this->columns)); $bk->append(') VALUES'); } }
public function build(Breakdown $bk, $tabs) { $bk->append(" " . $this->name); $bk->append(" AS "); if ($this->sql != null) { $bk->append(" ("); $bk->line($tabs); $bk->tabs($tabs + 1); $this->sql->build($bk, $tabs); $bk->line($tabs); $bk->append(" )"); $bk->line(0); } }
public function build(Breakdown $bk, $tabs) { $bk->line($tabs + 1); $bk->append(' ON DUPLICATE KEY UPDATE '); $columnCount = count($this->columns); $columnIndex = 1; /** @var Set $columnSet */ foreach ($this->columns as $columnSet) { $columnSet->build($bk, $tabs); if ($columnIndex++ < $columnCount) { $bk->append(','); } } }
public function buildUsing(Breakdown $bk, $tabs) { $doUsingClause = true; $doCommaUsing = false; foreach ($this->using as $using) { /** @var Using $using */ if ($doUsingClause) { $bk->line($tabs + 2); $bk->append(" USING ("); $doUsingClause = false; } if ($doCommaUsing) { $bk->append(", "); } else { $doCommaUsing = true; } $using->build($bk, $tabs); } if ($doUsingClause == false) { $bk->append(")"); } }
private function buildClauseAllOrderBy(Breakdown $bk, $tabs) { $doOrderByClause = true; $doCommaOrderBy = false; foreach ($this->orderBy as $orderBy) { /** @var Clause\OrderBy $orderBy */ if ($doOrderByClause) { $bk->line($tabs + 2); $bk->append(' ORDER BY'); $doOrderByClause = false; } if ($doCommaOrderBy) { $bk->append(','); } else { $doCommaOrderBy = true; } $orderBy->build($bk, $tabs); } }