Bug #54695 [Com]: getColumnMeta() throws warning in silent mode
| From: | adambaratz@php.net | Date: | Mon, 24 Apr 2017 20:27:51 +0000 |
| Subject: | Bug #54695 [Com]: getColumnMeta() throws warning in silent mode | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-208765@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=54695&edit=1
ID: 54695
Comment by: adambaratz@php.net
Reported by: david at grudl dot com
Summary: getColumnMeta() throws warning in silent mode
Status: Open
Type: Bug
Package: PDO related
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
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().
Previous Comments:
------------------------------------------------------------------------
[2016-09-18 18:41:33] 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.
------------------------------------------------------------------------
[2011-05-09 17:33:49] 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.".
------------------------------------------------------------------------
[2011-05-09 16:19:39] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54695&edit=1