Bug #54478 [Opn]: The pdo_pgsql specific implementation of inTransaction doesn't work as expected

From: Date: Wed, 06 Apr 2011 13:15:43 +0000
Subject: Bug #54478 [Opn]: The pdo_pgsql specific implementation of inTransaction doesn't work as expected
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-159979@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=54478&edit=1

 ID:                 54478
 User updated by:    phofstetter at sensational dot ch
 Reported by:        phofstetter at sensational dot ch
 Summary:            The pdo_pgsql specific implementation of
                     inTransaction doesn't work as expected
 Status:             Open
 Type:               Bug
 Package:            PDO related
 Operating System:   OSX, Linux, likely all
 PHP Version:        5.3.6
 Block user comment: N
 Private report:     N

 New Comment:

A bit of investigation revealed that the feature was removed in 300464

http://svn.php.net/viewvc?view=revision&revision=300464

I guess the unit test should be removed too, as well as the note in the
manual 
which states "Note that currently only the PostgreSQL driver implements
this 
method."


Previous Comments:
------------------------------------------------------------------------
[2011-04-06 14:59:11] phofstetter at sensational dot ch

Description:
------------
PHP 5.3.3 supposedly brought PDO::inTransaction() with a special
implementation 
for PostgreSQL wich uses libpq's PQtransactionStatus instead of internal

bookkeeping.

According to the test attached with the revision where this was added 
(is_in_transaction.phpt, revision 300351), inTransaction() is supposed
to return 
any of the PGSQL_TRANSACTION_* constants.

Unfortunately that's not the case and inTransaction(), even when used in

conjunction with PostgreSQL only returns boolean and doesn't use the
actual 
transaction status of the connection but just returns true or false
depending on 
whether PDO::beginTransaction() has been called or not.

PHP's own test runner illustrates the problem, which is why I don't
bother 
adding an additional test script - the included is_in_transaction.phpt
is 
enough:

http://gcov.php.net/viewer.php?
version=PHP_5_3&func=tests&file=ext%2Fpdo_pgsql%2Ftests%2Fis_in_transaction.phpt

Expected result:
----------------
When running the phpt file, I expect the following output:

Test PDO::PGSQL_TRANSACTION_INTRANS
int(2)
Test PDO::PGSQL_TRANSACTION_IDLE
int(0)
Test PDO::PGSQL_TRANSACTION_INERROR
int(3)
Test PDO::PGSQL_TRANSACTION_IDLE
int(0)


Actual result:
--------------
When running the phpt file, I (and PHP's webbased test runner) is
getting


Test PDO::PGSQL_TRANSACTION_INTRANS
int(1)
Test PDO::PGSQL_TRANSACTION_IDLE
int(0)
Test PDO::PGSQL_TRANSACTION_INERROR
int(1)
Test PDO::PGSQL_TRANSACTION_IDLE
int(0)



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=54478&edit=1


Thread (3 messages)

« previous php.bugs (#159979) next »