#46508 [Asn]: [PATCH]: getColumnMeta returns 'LONG','VAR_STRING','BLOB' as php native_type

[email protected] ("marques at displague dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               46508
 User updated by:  marques at displague dot com
 Reported By:      marques at displague dot com
 Status:           Assigned
 Bug Type:         PDO related
 Operating System: *
 PHP Version:      5.2.9
 Assigned To:      mysql
 New Comment:

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.


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

[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] [email protected]

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).

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

[2008-11-07 15:49:25] [email protected]

Patch: http://felipe.ath.cx/diff/bug46508.diff (5.3)

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

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/46508

-- 
Edit this bug report at http://bugs.php.net/?id=46508&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.