--- embedaddon/php/ext/pdo_pgsql/pgsql_statement.c 2012/02/21 23:47:59 1.1 +++ embedaddon/php/ext/pdo_pgsql/pgsql_statement.c 2013/10/14 08:02:28 1.1.1.4 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2012 The PHP Group | + | Copyright (c) 1997-2013 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.1 2012/02/21 23:47:59 misho Exp $ */ +/* $Id: pgsql_statement.c,v 1.1.1.4 2013/10/14 08:02:28 misho Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -362,8 +362,20 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, str } break; } + } else { +#endif + if (param->is_param) { + /* We need to manually convert to a pg native boolean value */ + if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL && + ((param->param_type & PDO_PARAM_INPUT_OUTPUT) != PDO_PARAM_INPUT_OUTPUT)) { + SEPARATE_ZVAL(¶m->parameter); + param->param_type = PDO_PARAM_STR; + ZVAL_STRINGL(param->parameter, Z_BVAL_P(param->parameter) ? "t" : "f", 1, 1); + } + } +#if HAVE_PQPREPARE } -#endif +#endif return 1; } @@ -524,7 +536,7 @@ static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int co *len = 0; return 0; } else { - char *tmp_ptr = PQunescapeBytea(*ptr, &tmp_len); + char *tmp_ptr = (char *)PQunescapeBytea((unsigned char *)*ptr, &tmp_len); if (!tmp_ptr) { /* PQunescapeBytea returned an error */ *len = 0; @@ -575,7 +587,7 @@ static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt add_assoc_long(return_value, "pgsql:oid", S->cols[colno].pgsql_type); /* Fetch metadata from Postgres system catalogue */ - spprintf(&q, 0, "SELECT TYPNAME FROM PG_TYPE WHERE OID=%d", S->cols[colno].pgsql_type); + spprintf(&q, 0, "SELECT TYPNAME FROM PG_TYPE WHERE OID=%u", S->cols[colno].pgsql_type); res = PQexec(S->H->server, q); efree(q);