Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #9883 from EOSIO/huangminghuang/fix-libpqxx-compat…
Browse files Browse the repository at this point in the history
…ibility

Fix problem with libpqxx 7.3.0 upgrade
  • Loading branch information
huangminghuang authored Jan 7, 2021
2 parents 7780d97 + 73963d6 commit 1297879
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions plugins/blockvault_client_plugin/postgres_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,14 @@ bool postgres_backend::propose_constructed_block(std::pair<uint32_t, uint32_t> w
pqxx::binarystring previous_block_id_blob(previous_block_id.data(), previous_block_id.size());
w.exec_prepared0("insert_constructed_block", watermark.first, watermark.second, lib, block_id_blob,
previous_block_id_blob, obj.id(), block_content.size());
auto r = w.exec_prepared1("get_block_insertion_result", obj.id());
obj.write(block_content.data(), block_content.size());
w.commit();
return true;
} catch (const pqxx::unexpected_rows&) {
} catch (const pqxx::unique_violation&) {
} catch (const pqxx::serialization_failure&) {
} catch (const pqxx::transaction_rollback&) {
}
auto r = w.exec_prepared("get_block_insertion_result", obj.id());
if (!r.empty()) {
obj.write(block_content.data(), block_content.size());
w.commit();
return true;
}
} catch (const pqxx::sql_error&) {
}

return false;
}
Expand All @@ -105,16 +104,14 @@ bool postgres_backend::append_external_block(uint32_t block_num, uint32_t lib, c
pqxx::binarystring previous_block_id_blob(previous_block_id.data(), previous_block_id.size());
w.exec_prepared0("insert_external_block", block_num, lib, block_id_blob, previous_block_id_blob, obj.id(),
block_content.size());
auto r = w.exec_prepared1("get_block_insertion_result", obj.id());
obj.write(block_content.data(), block_content.size());
w.commit();
return true;

} catch (const pqxx::unexpected_rows&) {
} catch (const pqxx::unique_violation&) {
} catch (const pqxx::serialization_failure&) {
} catch (const pqxx::transaction_rollback&) {
}
auto r = w.exec_prepared("get_block_insertion_result", obj.id());
if (!r.empty()) {
obj.write(block_content.data(), block_content.size());
w.commit();
return true;
}
} catch (const pqxx::sql_error&) {
}
return false;
}

Expand Down

0 comments on commit 1297879

Please sign in to comment.