Allow drivers to omit error code

And thus generate error messages that match what PDO emulation
would generate.

This fixes the error message regression from the previous commit.
This commit is contained in:
Nikita Popov 2020-12-10 16:03:22 +01:00
parent 15b51a215a
commit a5527577e7
6 changed files with 14 additions and 9 deletions

View file

@ -282,8 +282,7 @@ 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_pgsql_error_stmt_msg(
stmt, PGRES_FATAL_ERROR, "HY093", ZSTR_VAL(param->name));
pdo_pgsql_error_stmt_msg(stmt, 0, "HY093", ZSTR_VAL(param->name));
return 0;
}
}
@ -295,8 +294,7 @@ 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_pgsql_error_stmt_msg(
stmt, PGRES_FATAL_ERROR, "HY093", "parameter was not defined");
pdo_pgsql_error_stmt_msg(stmt, 0, "HY093", "parameter was not defined");
return 0;
}
case PDO_PARAM_EVT_EXEC_POST: