/** * @return Compiler */ public function getCompiler() : Compiler { if ($this->compiler === null) { $this->compiler = $this->connection->getCompiler(); } return $this->compiler; }
public function __construct(Connection $connection, Model $model) { $this->model = $model; $this->connection = $connection; $compiler = $connection->compiler(); $query = new Select($compiler, $model->getTable()); $whereCondition = new WhereCondition($this, $query); parent::__construct($compiler, $query, $whereCondition); }
/** * @param array &$columns (optional) * * @return \Opis\Database\ResultSet */ protected function query(array &$columns = array()) { $pk = $this->model->getPrimaryKey(); if (!$this->query->isLocked() && !empty($columns)) { $columns[] = $pk; } return $this->connection->query((string) $this->query->select($columns), $this->query->getCompiler()->getParams()); }
/** * @return array */ protected function &getResults() { if ($this->results === null) { $model = $this->modelClass; $this->model = new $model(); $results = $this->connection->query((string) $this->query, $this->params)->fetchClass($this->modelClass, array($this->readonly, $this->connection))->all(); $this->prepareResults($this->model, $results); $this->results =& $results; } return $this->results; }
/** * Delete records * * @param string|array $tables (optional) * * @return int */ public function delete($tables = array()) { parent::delete($tables); $compiler = $this->connection->getCompiler(); return $this->connection->count($compiler->delete($this->sql), $compiler->getParams()); }
/** * @param array $columns * * @return int */ public function set(array $columns) { parent::set($columns); $compiler = $this->connection->getCompiler(); return $this->connection->count($compiler->update($this->sql), $compiler->getParams()); }
/** * @param string $table * * @return boolean */ public function into(string $table) { parent::into($table); $compiler = $this->connection->getCompiler(); return $this->connection->command($compiler->insert($this->sql), $compiler->getParams()); }
/** * Delete records * * @param string|array $tables (optional) * * @return int */ public function delete($tables = array()) { parent::delete($tables); return $this->connection->count((string) $this, $this->compiler->getParams()); }
/** * @param array $columns * * @return int */ public function set(array $columns) { parent::set($columns); return $this->connection->count((string) $this, $this->compiler->getParams()); }
public function __construct(Connection $connection, array $values) { parent::__construct($connection->compiler()); $this->connection = $connection; $this->insert($values); }
public function __construct(Connection $connection, $tables) { parent::__construct($connection->compiler()); $this->tables = $tables; $this->connection = $connection; }
/** * @return mixed */ protected function execute() { return $this->connection->column((string) $this->query, $this->compiler->getParams()); }
/** * @param string $table * * @return boolean */ public function into($table) { parent::into($table); return $this->connection->command((string) $this, $this->compiler->getParams()); }