Ejemplo n.º 1
0
 public function update(UpdateStatement $update)
 {
     $joins = $this->handleJoins($update->getJoinClauses());
     $tables = $update->getTables();
     if ($joins !== '') {
         $joins = ' FROM ' . $this->handleTables($tables) . ' ' . $joins;
         $tables = array_values($tables);
     }
     $sql = 'UPDATE ';
     $sql .= $this->handleTables($tables);
     $sql .= $this->handleSetColumns($update->getColumns());
     $sql .= $joins;
     $sql .= $this->handleWheres($update->getWhereConditions());
     return $sql;
 }
Ejemplo n.º 2
0
 /**
  * @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());
 }
Ejemplo n.º 3
0
 /**
  * Returns the SQL for a update statement
  * 
  * @param   \Opis\Database\SQL\UpdateStatement  $update
  * 
  * @return  string
  */
 public function update(UpdateStatement $update)
 {
     $sql = 'UPDATE ';
     $sql .= $this->handleTables($update->getTables());
     $sql .= $this->handleJoins($update->getJoinClauses());
     $sql .= $this->handleSetColumns($update->getColumns());
     $sql .= $this->handleWheres($update->getWhereConditions());
     return $sql;
 }
Ejemplo n.º 4
0
 /**
  * @param   array   $columns
  * 
  * @return  int
  */
 public function set(array $columns)
 {
     parent::set($columns);
     return $this->connection->count((string) $this, $this->compiler->getParams());
 }