X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fphp_pqcur.c;h=1ff10da22c5e9d103a2b0dc2aeacaa30a669efee;hb=f75655ac7742fdd5c5e6968477d216b1b892475b;hp=afaa6b36529b31657019c377cf1d2aacf6067d7f;hpb=d662d7beb20a15ca8ca95761543f6b9d3b6bff29;p=m6w6%2Fext-pq diff --git a/src/php_pqcur.c b/src/php_pqcur.c index afaa6b3..1ff10da 100644 --- a/src/php_pqcur.c +++ b/src/php_pqcur.c @@ -31,7 +31,7 @@ static HashTable php_pqcur_object_prophandlers; static void cur_close(php_pqcur_object_t *obj TSRMLS_DC) { - if (obj->intern->open) { + if (obj->intern->open && obj->intern->conn->intern) { PGresult *res; smart_str cmd = {0}; @@ -79,8 +79,10 @@ static void cur_fetch_or_move(INTERNAL_FUNCTION_PARAMETERS, const char *action, if (!rc) { throw_exce(EX_IO TSRMLS_CC, "Failed to %s cursor (%s)", *action == 'f' ? "fetch from" : "move in", PHP_PQerrorMessage(obj->intern->conn->intern->conn)); +#if HAVE_PQSETSINGLEROWMODE } else if (obj->intern->conn->intern->unbuffered && !PQsetSingleRowMode(obj->intern->conn->intern->conn)) { throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to enable unbuffered mode (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn)); +#endif } else { php_pq_callback_recurse(&obj->intern->conn->intern->onevent, &resolver TSRMLS_CC); obj->intern->conn->intern->poller = PQconsumeInput;