- $bAnyBusy = true;
- while ($bAnyBusy) {
- $bAnyBusy = false;
- for ($i = 0; $i <= $iLoadThreads; $i++) {
- if (pg_connection_busy($aDBInstances[$i]->connection)) $bAnyBusy = true;
+ $bFailed = false;
+ for ($i = 0; $i <= $iLoadThreads; $i++) {
+ while (($hPGresult = pg_get_result($aDBInstances[$i]->connection)) !== false) {
+ $resultStatus = pg_result_status($hPGresult);
+ // PGSQL_EMPTY_QUERY, PGSQL_COMMAND_OK, PGSQL_TUPLES_OK,
+ // PGSQL_COPY_OUT, PGSQL_COPY_IN, PGSQL_BAD_RESPONSE,
+ // PGSQL_NONFATAL_ERROR and PGSQL_FATAL_ERROR
+ echo 'Query result ' . $i . ' is: ' . $resultStatus . "\n";
+ if ($resultStatus != PGSQL_COMMAND_OK && $resultStatus != PGSQL_TUPLES_OK) {
+ $resultError = pg_result_error($hPGresult);
+ echo '-- error text ' . $i . ': ' . $resultError . "\n";
+ $bFailed = true;
+ }