public function insert($table, $columns)
    {
        $params = [];
        $sql = $this->db->getQueryBuilder()->insert($table, $columns, $params);
        $returnColumns = $this->getTableSchema($table)->primaryKey;
        if (!empty($returnColumns)) {
            $returning = [];
            foreach ((array) $returnColumns as $name) {
                $returning[] = $this->quoteColumnName($name);
            }
            $sql .= ' RETURNING ' . implode(', ', $returning);
        }

        $command = $this->db->createCommand($sql, $params);
        $command->prepare(false);
        $result = $command->queryOne();

        return !$command->pdoStatement->rowCount() ? false : $result;
    }
public function insert($table, $columns)
    {
        $params = [];
        $sql = $this->db->getQueryBuilder()->insert($table, $columns, $params);
        $returnColumns = $this->getTableSchema($table)->primaryKey;
        if (!empty($returnColumns)) {
            $returning = [];
            foreach ((array) $returnColumns as $name) {
                $returning[] = $this->quoteColumnName($name);
            }
            $sql .= ' RETURNING ' . implode(', ', $returning);
        }

        $command = $this->db->createCommand($sql, $params);
        $command->prepare(false);
        $result = $command->queryOne();

        return !$command->pdoStatement->rowCount() ? false : $result;
    }
public function insert ( $ table , $ columns ) { $ params = [ ] ; $ sql = $ this -> db -> getQueryBuilder ( ) -> insert ( $ table , $ columns , $ params ) ; $ returnColumns = $ this -> getTableSchema ( $ table ) -> primaryKey ; if ( ! empty ( $ returnColumns ) ) { $ returning = [ ] ; foreach ( ( array ) $ returnColumns as $ name ) { $ returning [ ] = $ this -> quoteColumnName ( $ name ) ; } $ sql .= ' RETURNING ' . implode ( ', ' , $ returning ) ; } $ command = $ this -> db -> createCommand ( $ sql , $ params ) ; $ command -> prepare ( false ) ; $ result = $ command -> queryOne ( ) ; return ! $ command -> pdoStatement -> rowCount ( ) ? false : $ result ; }
{@inheritdoc}
{