diff options
Diffstat (limited to 'ext/pdo_pgsql/pgsql_statement.c')
-rw-r--r-- | ext/pdo_pgsql/pgsql_statement.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index 33aea2335..1842ad572 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2008 The PHP Group | + | Copyright (c) 1997-2009 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pgsql_statement.c,v 1.31.2.12.2.11 2008/02/26 00:14:04 iliaa Exp $ */ +/* $Id: pgsql_statement.c,v 1.31.2.12.2.14 2008/12/31 11:17:42 sebastian Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -246,6 +246,9 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data * break; case PDO_PARAM_EVT_ALLOC: + case PDO_PARAM_EVT_EXEC_POST: + case PDO_PARAM_EVT_FETCH_PRE: + case PDO_PARAM_EVT_FETCH_POST: /* work is handled by EVT_NORMALIZE */ return 1; @@ -293,10 +296,16 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data * S->param_types[param->paramno] = OIDOID; return 1; } else { + int len; + SEPARATE_ZVAL_IF_NOT_REF(¶m->parameter); Z_TYPE_P(param->parameter) = IS_STRING; - Z_STRLEN_P(param->parameter) = php_stream_copy_to_mem(stm, - &Z_STRVAL_P(param->parameter), PHP_STREAM_COPY_ALL, 0); + + if ((len = php_stream_copy_to_mem(stm, &Z_STRVAL_P(param->parameter), PHP_STREAM_COPY_ALL, 0)) > 0) { + Z_STRLEN_P(param->parameter) = len; + } else { + ZVAL_EMPTY_STRING(param->parameter); + } } } else { /* expected a stream resource */ @@ -598,6 +607,7 @@ static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, unsigned case PDO_PARAM_STR: case PDO_PARAM_STMT: case PDO_PARAM_INPUT_OUTPUT: + default: break; } } |