Skip to content

Commit c58707d

Browse files
impl: add a statement name to errorInfo()
1 parent da6b54b commit c58707d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

ext/pdo_pgsql/pgsql_statement.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,10 @@ static int pgsql_stmt_get_attr(pdo_stmt_t *stmt, zend_long attr, zval *val)
715715
if(stmt->executed) {
716716
ZVAL_LONG(val, PQresultMemorySize(S->result));
717717
} else {
718-
pdo_pgsql_error_stmt_msg(stmt, 0, "HY000", "statement has not been executed yet");
718+
char *tmp;
719+
spprintf(&tmp, 0, "statement '%s' has not been executed yet", S->stmt_name);
720+
721+
pdo_pgsql_error_stmt_msg(stmt, 0, "HY000", tmp);
719722
ZVAL_NULL(val);
720723
}
721724
return 1;

ext/pdo_pgsql/tests/result_memory_size.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ Result set with only 1 row: int(%d)
4343
Result set with many rows: int(%d)
4444
Large result sets should require more memory than small ones: bool(true)
4545
Statements that are not executed should not consume memory: NULL
46-
and should emit Error: HY000: 0: statement has not been executed yet
46+
and should emit Error: HY000: 0: statement '%s' has not been executed yet

0 commit comments

Comments
 (0)