Skip to content

Commit

Permalink
Support multiple statements
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Sep 20, 2021
1 parent a083fae commit 4e90a00
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/PqResultImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ std::vector<bool> PqResultImpl::_cache::get_column_known(const std::vector<Oid>&
}

void PqResultImpl::prepare() {
if (immediate_) {
return;
}

LOG_DEBUG << sql_;

// Prepare query
Expand Down Expand Up @@ -465,19 +469,20 @@ bool PqResultImpl::step_run() {

ExecStatusType status = PQresultStatus(pRes_);

switch (status) {
case PGRES_FATAL_ERROR:
{
PQclear(pRes_);
pRes_ = NULL;
conn_stop("Failed to fetch row");
return false;
}
case PGRES_SINGLE_TUPLE:
if (status == PGRES_FATAL_ERROR) {
PQclear(pRes_);
pRes_ = NULL;
conn_stop("Failed to fetch row");
return false;
}

cache.set(pRes_);

if (status == PGRES_SINGLE_TUPLE) {
return false;
default:
return step_done();
}

return step_done();
}

bool PqResultImpl::step_done() {
Expand Down

0 comments on commit 4e90a00

Please sign in to comment.