When a driver reports an error during EVT_ALLOC (and some over EVTs),
make sure we handle it as usual, i.e. warn or throw.

This requires some adjustments in PDO PgSQL to stop manually doing
this through an impl error.

Unfortunately the PDO PgSQL error messages regress because of this,
as they now include a completely arbitrary error code. There doesn't
seem to be an ability to skip it right now.
This commit is contained in:
Nikita Popov 2020-12-10 15:51:17 +01:00
parent dde5572937
commit 15b51a215a
9 changed files with 21 additions and 12 deletions

View file

@ -282,7 +282,8 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
ZEND_ATOL(param->paramno, namevar + 1);
param->paramno--;
} else {
pdo_raise_impl_error(stmt->dbh, stmt, "HY093", ZSTR_VAL(param->name));
pdo_pgsql_error_stmt_msg(
stmt, PGRES_FATAL_ERROR, "HY093", ZSTR_VAL(param->name));
return 0;
}
}
@ -294,7 +295,8 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
return 1;
}
if (!zend_hash_index_exists(stmt->bound_param_map, param->paramno)) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "parameter was not defined");
pdo_pgsql_error_stmt_msg(
stmt, PGRES_FATAL_ERROR, "HY093", "parameter was not defined");
return 0;
}
case PDO_PARAM_EVT_EXEC_POST: