Skip Menu |

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 44732
Status: resolved
Priority: 0/
Queue: DBD-Pg

People
Owner: greg [...] turnstep.com
Requestors: rweikusat [...] mssgmbh.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 2.13.0



Subject: sqlstate not set in pg_st_prepare_statement for 'new prepare'
When not using 'oldprepare', 'pg_st_prepare_statement' does a direct PQprepare call on line 2115 of the dbdimp.c-file while the call is done via the _result-function otherwise. This implies that the imp_dbh->sqlstate value is only set after an 'oldprepare' failed (via -> _result -> _sqlstate) while the code just disposes of the result value (after extracting the status) for the 'new prepare' case. Attached is a patch which changes the code to also call _sqlstate for the 'new prepare'-case, thereby causing imp_dbh->sqlstate to consistently have a value.
Subject: p
Download p
application/octet-stream 652b

Message body not shown because it is not plain text.

This is the same file, only an attempt to get RT to (correctly) treat it as text by assuming that it is at least not more stupid than MS Windows.
Subject: p.txt
Index: DBD-Pg/dbdimp.c =================================================================== RCS file: /sysdata/cvs/DBD-Pg/dbdimp.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -r1.1.1.1 -r1.1.1.1.2.1 --- DBD-Pg/dbdimp.c 1 Apr 2009 15:18:00 -0000 1.1.1.1 +++ DBD-Pg/dbdimp.c 1 Apr 2009 15:49:05 -0000 1.1.1.1.2.1 @@ -2113,9 +2113,9 @@ TRACE_PQPREPARE; result = PQprepare(imp_dbh->conn, imp_sth->prepare_name, statement, params, imp_sth->PQoids); + status = _sqlstate(aTHX_ imp_dbh, result); + if (result) { - TRACE_PQRESULTSTATUS; - status = PQresultStatus(result); TRACE_PQCLEAR; PQclear(result); }
Looks good to me, applied in r12678. Thanks!