Edit report at http://bugs.php.net/bug.php?id=46508&edit=1
ID: 46508
Updated by: uw@php.net
Reported by: marques at displague dot com
Summary: [PATCH]: getColumnMeta returns
'LONG','VAR_STRING','BLOB' as php native_type
-Status: Assigned
+Status: Open
Type: Bug
Package: PDO related
Operating System: *
PHP Version: 5.2.9
-Assigned To: mysql
+Assigned To:
New Comment:
Whatever the docs say, what counts is "EXPERIMENTAL" = "TENTATIVE" =
"UNDEFINED". It is irrelevant how meaningful and sensible your
suggestion is.
If you want any changes to PDO, please write an RFC/discuss on
internal/do whatever the current procedure is to get the "EXPERIMENTAL"
removed. Specification via bug reports does not make much sense to me.
You fix one and break another causing a bug report stating just the
opposite and, for example, claiming you break backwards compatibility.
The underlying issue is the lack of a clear definition. The issue is the
"EXPERIMENTAL".
I do understand how annoying the answer is. But please respect that
"specification via bug reports" is not a good approach and sometimes it
is better to go a step back and do it right: fix PDO as such.
Whoever wants, may play the patch-and-work-without-specs game. But I
won't do it. Its an endless game leading nowhere: leaving bug open,
unassigning mysql (at least as long as there is no clear specs).
Previous Comments:
------------------------------------------------------------------------
[2009-06-29 10:18:50] marques at displague dot com
I stated in the bug report that the return values do not match up with
the documentation. The docs state (pretty clearly):
http://php.net/manual/en/pdostatement.getcolumnmeta.php:
native_type The PHP native type used to represent the column value.
driver:decl_type The SQL type used to represent the column value in the
database. If the column in the result set is the result of a function,
this value is not returned by PDOStatement::getColumnMeta().
pdo_type The type of this column as represented by the PDO::PARAM_*
constants.
The problems are that (per the docs) native_type is missed for some
types (TINYINT) and that the native_type values currently returned
should be in driver:decl_type, and PHP native types should be returned
for native_type instead.
------------------------------------------------------------------------
[2009-06-29 09:42:27] uwendel at mysql dot com
Why would I bother about a function that has no specification? Without a
specification there is no definition of how things should go and there
is no bug - by definition...
"Warning
This function is EXPERIMENTAL. The behaviour of this function, its name,
and surrounding documentation may change without notice in a future
release of PHP. This function should be used at your own risk. ",
http://de.php.net/manual/en/pdostatement.getcolumnmeta.php
There needs to be a proper PDO spec before one can decide about any bug
report. IMHO the bug report should be closed as bogus.
------------------------------------------------------------------------
[2009-04-10 14:01:57] php at displague dot com
This should probably be the topic of another bug, but TINYINT doesn't
return a native_type (I'm guessing because TINY is used everywhere, but
not TINYINT - maybe another constant is needed).
mysql://user@host/db> show columns from table like 'disable' \G;
*************************** 1. row ***************************
Field: disable
Type: tinyint(4)
Null: NO
Key:
Default: 0
Extra:
1 row in set (0.00 sec)
getColumnMeta (php 5.2.9) returns:
Array
(
[flags] => Array
(
[0] => not_null
)
[table] => promo_item
[name] => disable
[len] => 4
[precision] => 0
[pdo_type] => 2
)
native_type is missing.
Is there any chance this correction will make it into 5.2.x?
------------------------------------------------------------------------
[2008-11-07 16:24:52] felipe@php.net
Hi Marques, good observation! I've updated the patch. ;)
Thanks.
------------------------------------------------------------------------
[2008-11-07 16:02:59] marques at displague dot com
The values that are currently being reported may belong in the
getmetacolumn array member 'driver:decl_type' (per the getColumnMeta
documentation example).
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=46508--
Edit this bug report at http://bugs.php.net/bug.php?id=46508&edit=1