SQLBuilder\Universal\Query\InsertQuery::into PHP Method

into() public method

public into ( $table )
    public function into($table)
    {
        $this->intoTable = $table;
        return $this;
    }

Usage Example

Example #1
0
 /**
  * Simply create record without validation and triggers.
  *
  * @param array $args
  */
 public function rawCreate(array $args)
 {
     $dsId = $this->writeSourceId;
     $conn = $this->getWriteConnection();
     $k = static::PRIMARY_KEY;
     $driver = $this->getWriteQueryDriver();
     $query = new InsertQuery();
     $query->insert($args);
     $query->into($this->table);
     $query->returning($k);
     $arguments = new ArgumentArray();
     $sql = $query->toSql($driver, $arguments);
     $stm = $conn->prepare($sql);
     $stm->execute($arguments->toArray());
     $pkId = null;
     if ($driver instanceof PDOPgSQLDriver) {
         $pkId = $stm->fetchColumn();
     } else {
         // lastInsertId is supported in SQLite and MySQL
         $pkId = $conn->lastInsertId();
     }
     $this->_data = $args;
     $this->_data[$k] = $pkId;
     return $this->reportSuccess('Create success', array('sql' => $sql, 'type' => Result::TYPE_CREATE));
 }
All Usage Examples Of SQLBuilder\Universal\Query\InsertQuery::into