Branch: Tag:

2018-05-01

2018-05-01 09:01:31 by Stephen R. van den Berg <srb@cuci.nl>

pgsql: Make affected_rows() and status_command_complete() wait for a meaningful result.

749:       //! Returns the command-complete status for this query.    //! -  //! @seealso -  //! @[affected_rows()] +  //! @note +  //! This method should normally be called after EOF has been reached. +  //! If it is called before, all unfetched result rows will be discarded.    //!    //! @note    //! This function is PostgreSQL-specific. -  +  //! +  //! @[affected_rows()], @[eof()]    /*semi*/final string status_command_complete() { -  +  if (!statuscmdcomplete) +  while (fetch_row_array());    return statuscmdcomplete;    }       //! Returns the number of affected rows by this query.    //! -  //! @seealso -  //! @[status_command_complete()] +  //! @note +  //! This method should normally be called after EOF has been reached. +  //! If it is called before, all unfetched result rows will be discarded.    //!    //! @note    //! This function is PostgreSQL-specific. -  +  //! +  //! @seealso +  //! @[status_command_complete()], @[eof()]    /*semi*/final int affected_rows() {    int rows; -  if (statuscmdcomplete) -  sscanf(statuscmdcomplete, "%*s %d %d", rows, rows); +  sscanf(status_command_complete(), "%*s %d %d", rows, rows);    return rows;    }