| 311 | } |
| 312 | |
| 313 | bool PgReader::NextBuffer() |
| 314 | { |
| 315 | if (m_cur_row >= m_cur_nrows || !m_cur_result) |
| 316 | { |
| 317 | static std::string fetch = "FETCH 2 FROM cur"; |
| 318 | if (m_cur_result) |
| 319 | PQclear(m_cur_result); |
| 320 | m_cur_result = pg_query_result(m_session, fetch); |
| 321 | bool logOutput = (log()->getLevel() > LogLevel::Debug3); |
| 322 | if (logOutput) |
| 323 | log()->get(LogLevel::Debug3) << "SQL: " << fetch << std::endl; |
| 324 | if ((PQresultStatus(m_cur_result) != PGRES_TUPLES_OK) || |
| 325 | (PQntuples(m_cur_result) == 0)) |
| 326 | { |
| 327 | PQclear(m_cur_result); |
| 328 | m_cur_result = NULL; |
| 329 | m_atEnd = true; |
| 330 | return false; |
| 331 | } |
| 332 | |
| 333 | m_cur_row = 0; |
| 334 | m_cur_nrows = PQntuples(m_cur_result); |
| 335 | } |
| 336 | m_patch.hex = PQgetvalue(m_cur_result, m_cur_row, 0); |
| 337 | m_patch.count = atoi(PQgetvalue(m_cur_result, m_cur_row, 1)); |
| 338 | m_patch.remaining = m_patch.count; |
| 339 | m_patch.update_binary(); |
| 340 | |
| 341 | m_cur_row++; |
| 342 | return true; |
| 343 | } |
| 344 | |
| 345 | |
| 346 | point_count_t PgReader::read(PointViewPtr view, point_count_t count) |
nothing calls this directly
no test coverage detected