diff options
| author | Matteo Beccati <mbeccati@php.net> | 2009-05-12 22:17:50 +0000 |
|---|---|---|
| committer | Matteo Beccati <mbeccati@php.net> | 2009-05-12 22:17:50 +0000 |
| commit | 82151d4dc30e5b8718e942faa436eddf88588d6b (patch) | |
| tree | 883b9bcbb6d71d4bd8d059a3bcd6827c5f250e06 /ext/pdo_pgsql/pgsql_statement.c | |
| parent | 92288eca5c3a48646d8525d9d3f8dbc03b780b67 (diff) | |
| download | php-git-82151d4dc30e5b8718e942faa436eddf88588d6b.tar.gz | |
- Fixed bug #48188
Diffstat (limited to 'ext/pdo_pgsql/pgsql_statement.c')
| -rw-r--r-- | ext/pdo_pgsql/pgsql_statement.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index b1fccebcdf..aa69035f64 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -131,6 +131,13 @@ static int pgsql_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) if (S->cursor_name) { char *q = NULL; + + if (S->is_prepared) { + spprintf(&q, 0, "CLOSE %s", S->cursor_name); + S->result = PQexec(H->server, q); + efree(q); + } + spprintf(&q, 0, "DECLARE %s SCROLL CURSOR WITH HOLD FOR %s", S->cursor_name, stmt->active_query_string); S->result = PQexec(H->server, q); efree(q); @@ -142,6 +149,9 @@ static int pgsql_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) return 0; } + /* the cursor was declared correctly */ + S->is_prepared = 1; + /* fetch to be able to get the number of tuples later, but don't advance the cursor pointer */ spprintf(&q, 0, "FETCH FORWARD 0 FROM %s", S->cursor_name); S->result = PQexec(H->server, q); |
