public function insertGetLastId(array $data)
    {
        // create build str
        $field_str = '';
        $value_str = '';
        foreach ($data as $key => $value) {
            $field_str .= ' '.self::_wrapRow($key).',';
            $plh = self::_getPlh();
            $this->_bind_params[$plh] = $value;
            $value_str .= ' '.$plh.',';
        }

        $field_str = rtrim($field_str, ',');
        $value_str = rtrim($value_str, ',');

        $this->_insert_str = ' ('.$field_str.') VALUES ('.$value_str.') RETURNING id ';
        // execute
        $this->_buildInsert();
        $this->_execute();
        $result = $this->_pdoSt->fetch(PDO::FETCH_ASSOC);

        return $result['id'];
    }
public function insertGetLastId(array $data)
    {
        // create build str
        $field_str = '';
        $value_str = '';
        foreach ($data as $key => $value) {
            $field_str .= ' '.self::_wrapRow($key).',';
            $plh = self::_getPlh();
            $this->_bind_params[$plh] = $value;
            $value_str .= ' '.$plh.',';
        }

        $field_str = rtrim($field_str, ',');
        $value_str = rtrim($value_str, ',');

        $this->_insert_str = ' ('.$field_str.') VALUES ('.$value_str.') RETURNING id ';
        // execute
        $this->_buildInsert();
        $this->_execute();
        $result = $this->_pdoSt->fetch(PDO::FETCH_ASSOC);

        return $result['id'];
    }
public function insertGetLastId ( array $ data ) { // create build str $ field_str = '' ; $ value_str = '' ; foreach ( $ data as $ key => $ value ) { $ field_str .= ' ' . self :: _wrapRow ( $ key ) . ',' ; $ plh = self :: _getPlh ( ) ; $ this -> _bind_params [ $ plh ] = $ value ; $ value_str .= ' ' . $ plh . ',' ; } $ field_str = rtrim ( $ field_str , ',' ) ; $ value_str = rtrim ( $ value_str , ',' ) ; $ this -> _insert_str = ' (' . $ field_str . ') VALUES (' . $ value_str . ') RETURNING id ' ; // execute $ this -> _buildInsert ( ) ; $ this -> _execute ( ) ; $ result = $ this -> _pdoSt -> fetch ( PDO :: FETCH_ASSOC ) ; return $ result [ 'id' ] ; }
get last insert ID for postgresql

@param  array $data
@return  null/int
@throws  \PDOException
get last insert ID for postgresql