ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-dev
php-dev
#37026 [Opn]: PDOStatemenet::execute() returns always false
by Kubis At Pawouk Dot Net other posts by this author
Apr 9 2006 12:57PM messages near this date
#37026 [Opn->Bgs]: PDOStatemenet::execute() returns always false | #3276 [Com]: Add PGP support
ID:               37026
 User updated by:  kubis at pawouk dot net
 Reported By:      kubis at pawouk dot net
 Status:           Open
 Bug Type:         PDO related
 Operating System: Windows XP
 PHP Version:      5.1.2
 New Comment:

there is a typo:
sentence "but with version 5.2.1 it returns false"  should be "but with
version 5.1.2 it returns false"


Previous Comments:
------------------------------------------------------------------------

[2006-04-09 19:46:53] kubis at pawouk dot net

Description:
------------
PDOStatement::execute() returns false even if the statement has been
executed correctly.

I have tried it with PDO drivers for postgresql packaged with PHP
version 5.1, it returns correctly true, but with version 5.2.1 it
returns false. I ran into this problem while executing unit tests after
an upgrade.

According to manual page should PDOStatement::execute() return true if
the statement has been executed properly or false if not

Reproduce code:
---------------
try {
	$db = DBShop::getInstance();	//
	$stmt = $db-> prepare('SELECT 1 AS testcolumn1, 2 AS testcolumn2');
	$count1 = $stmt-> columnCount();
	$res = $stmt-> execute();
	$count2 = $stmt-> columnCount();
} catch (Exception $e){
	$fail[] = self::errorMsg($e, 'Unable to test columnCount()');
	break;
}
$this-> assertTrue($res, 'DBStatement::execute() returned false, should
be true');
$this-> assertSame(2, $count2, 'DBStatement::columnCount() did not
return expected value');

Expected result:
----------------
no failure in unit test:
- $res is true
- $count2 is 2

Actual result:
--------------
PHPUnit reports "DBStatement::execute() returned false, should be
true", so $res is not true; but $count2 is integer of value 2, thus the
statement has been executed properly


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


-- 
Edit this bug report at http://bugs.php.net/?id=37026&edit=1
Thread:
Kubis At Pawouk Dot Net
edink
Kubis At Pawouk Dot Net

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved