php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38252 Incorrect PDO error message
Submitted: 2006-07-29 18:06 UTC Modified: 2006-12-04 02:40 UTC
From: stochnagara at hotmail dot com Assigned:
Status: Closed Package: PDO related
PHP Version: 5.2.0RC1 OS: windows xp
Private report: No CVE-ID:
 [2006-07-29 18:06 UTC] stochnagara at hotmail dot com
Description:
------------
PDO gives an inconsisten error message when I use the new PDO::ATTR_DEFAULT_FETCH_MODE in combination with PDO::FETCH_INTO.

Reproduce code:
---------------
<?

$pdo = new PDO ('sqlite::memory:');

$pdo->exec ("create table test (id integer primary key, n text)");
$pdo->exec ("INSERT INTO test (n) VALUES ('hi')");

$pdo->setAttribute (PDO::ATTR_DEFAULT_FETCH_MODE, array (PDO::FETCH_INTO, $a));
$stmt = $pdo->prepare ("SELECT * FROM test");
$stmt->execute();
var_dump($stmt->fetchAll());


Expected result:
----------------
i don't know exactly

Actual result:
--------------
Warning: PDOStatement::fetchAll() [function.PDOStatement-fetchAll]: SQLSTATE[HY000]: General error: PDO::FETCH_LAZY can't be used with PDOStatement::fetchAll() in ... on line 11
bool(false) 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-29 18:14 UTC] stochnagara at hotmail dot com
I get the same error when I use this:

$pdo->setAttribute (PDO::ATTR_DEFAULT_FETCH_MODE, array (PDO::FETCH_CLASS, 'SimpleXMLElement'));
 [2006-07-29 18:23 UTC] pajoye@php.net
FETCH_INTO and FETCH_CLASS are not yet supported as default fetch mode. I will update the code to report the correct error.
 [2006-12-04 02:40 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 04:01:55 2014 UTC