php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54695 getColumnMeta() throws warning in silent mode
Submitted: 2011-05-09 16:19 UTC Modified: 2020-12-11 14:45 UTC
From: david at grudl dot com Assigned:
Status: Duplicate Package: PDO related
PHP Version: 5.3.6 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: david at grudl dot com
New email:
PHP Version: OS:

 

 [2011-05-09 16:19 UTC] david at grudl dot com
Description:
------------
PDO::ERRMODE_SILENT is not respected by PDOStatement::getColumnMeta()

Test script:
---------------
$pdo = new PDO('sqlite2:demo.db'); // SQLite does not support getColumnMeta
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);

$result = $pdo->query('SELECT * FROM users');
$result->getColumnMeta(1); 

Expected result:
----------------
no warning

Actual result:
--------------
Warning: PDOStatement::getColumnMeta() [pdostatement.getcolumnmeta]: SQLSTATE[IM001]: Driver does not support this function: driver doesn't support meta data 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-09 17:33 UTC] uw@php.net
-Type: Bug +Type: Feature/Change Request
 [2011-05-09 17:33 UTC] uw@php.net
I tend to say that's a valid and important warning. Not every PDO driver implements this function, see also http://de2.php.net/manual/en/pdostatement.getcolumnmeta.php . 

I read it that you are proposing to implement this function. Thus, changing from Bug Type "Bug" to "Feature/Change Request.".
 [2016-09-18 18:41 UTC] cmb@php.net
-Type: Feature/Change Request +Type: Bug
 [2016-09-18 18:41 UTC] cmb@php.net
> I read it that you are proposing to implement this function.

In the description, the OP wrote:

> PDO::ERRMODE_SILENT is not respected by
> PDOStatement::getColumnMeta()

So obviously, this is not about requesting support for
PDOStatement::getColumnMeta() for the sqlite (not sqlite3 driver),
but rather about the misbehaving of throwing a warning when the
user requested silence.

> I tend to say that's a valid and important warning.

Sure. However, other warnings (e.g. for SQL parse errors) most
certainly are important, too, but these are suppressed with
PDO::ERRMODE_SILENT. So, in my opinion, this is clearly a bug.
 [2017-04-24 20:27 UTC] adambaratz@php.net
pdo_raise_impl_error does nothing for silent mode, so it falls through to the case for warnings. This function would have to be updated so it records an error that can be retrieved by the handle/statement fetch_err functions. This will require some refactoring, since those functions use driver-specific data structures.

FWIW, pdo_sqlite now supports PDOStatement::getColumnMeta().
 [2020-12-11 14:45 UTC] nikic@php.net
-Status: Open +Status: Duplicate
 [2020-12-11 14:45 UTC] nikic@php.net
Same issue as bug #71941.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 06:01:30 2024 UTC