Skip to content

Commit

Permalink
Add back fetchErr
Browse files Browse the repository at this point in the history
This was removed at some point.

Fixes #73
  • Loading branch information
Aatch committed Sep 29, 2015
1 parent 52a0355 commit 705b398
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pdo_pgsql_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,22 @@ namespace HPHP {
return 1;
}

bool PDOPgSqlConnection::fetchErr(PDOStatement *stmt, Array &info) {
if (stmt == nullptr) {
info.append(m_lastExec == InvalidOid ? Variant(Variant::NullInit()) : Variant(m_lastExec));
info.append(err_msg.empty() ? Variant(Variant::NullInit()) : Variant(err_msg));
return true;
} else {
auto *s = static_cast<PDOPgSqlStatement *>(stmt);
auto status = s->m_result.status();
auto emsg = s->err_msg;

info.append(status == InvalidOid ? Variant(Variant::NullInit()) : Variant(status));
info.append(emsg.empty() ? Variant(Variant::NullInit()) : Variant(emsg));
return true;
}
}

bool PDOPgSqlConnection::setAttribute(int64_t attr, const Variant &value){
switch(attr){
case PDO_ATTR_EMULATE_PREPARES:
Expand Down
2 changes: 2 additions & 0 deletions pdo_pgsql_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ namespace HPHP {
virtual int getAttribute(int64_t attr, Variant &value);
virtual bool setAttribute(int64_t attr, const Variant &value);

virtual bool fetchErr(PDOStatement *stmt, Array &info);

String pgsqlLOBCreate();

bool preparer(const String& sql, sp_PDOStatement *stmt, const Variant& options) override;
Expand Down

0 comments on commit 705b398

Please sign in to comment.