New function GncSqlConnection::dberror().

GncDbiSqlResult::dberror() just calls it instead of retrieving the dbi_conn
to call dbi_conn_error() itself.
This commit is contained in:
John Ralls 2016-07-18 15:11:35 -07:00
parent 583c951adc
commit e0d5cc5b0b
4 changed files with 8 additions and 7 deletions

View File

@ -2044,12 +2044,6 @@ GncDbiSqlResult::begin()
return m_sentinel;
}
int
GncDbiSqlResult::dberror()
{
return dbi_conn_error(m_conn->conn(), nullptr);
}
uint64_t
GncDbiSqlResult::size() const noexcept
{

View File

@ -109,6 +109,8 @@ public:
bool add_columns_to_table (const std::string&, const ColVec&)
const noexcept override;
std::string quote_string (const std::string&) const noexcept override;
int dberror() const noexcept override {
return dbi_conn_error(m_conn, nullptr); }
QofBackend* qbe () const noexcept { return m_qbe; }
dbi_conn conn() const noexcept { return m_conn; }
GncDbiProvider* provider() { return m_provider; }
@ -181,8 +183,8 @@ public:
m_conn{conn}, m_dbi_result{result}, m_iter{this}, m_row{&m_iter},
m_sentinel{nullptr} {}
~GncDbiSqlResult();
int dberror();
uint64_t size() const noexcept;
int dberror() { return m_conn->dberror(); }
GncSqlRow& begin();
GncSqlRow& end() { return m_sentinel; }
protected:

View File

@ -188,6 +188,10 @@ public:
const noexcept = 0;
virtual std::string quote_string (const std::string&)
const noexcept = 0;
/** Get the connection error value.
* If not 0 will normally be meaningless outside of implementation code.
*/
virtual int dberror() const noexcept = 0;
};
/**

View File

@ -104,6 +104,7 @@ public:
const noexcept override { return false; }
virtual std::string quote_string (const std::string& str)
const noexcept override { return std::string{str}; }
int dberror() const noexcept override { return 0; }
private:
GncMockSqlResult m_result;
};