php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56311 PDO/MySQL column metadata native_type broken
Submitted: 2005-02-20 06:12 UTC Modified: 2005-02-20 18:18 UTC
From: thekid@php.net Assigned:
Status: Closed Package: PDO_MYSQL (PECL)
PHP Version: 5_1 CVS-2005-02-20 (dev) 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.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: thekid@php.net
New email:
PHP Version: OS:

 

 [2005-02-20 06:12 UTC] thekid@php.net
Description:
------------
native_type (returned from PDOStatement::getColumnMeta()) was showing weird behaviour in PDO/MySQL, mostly not existing at all and showing incorrect values (e.g. "DECIMAL" for  varchars).

Reproduce code:
---------------
<?php
  $dbh= new PDO('mysql:host='.$argv[1], $argv[2], $argv[3]); 

  $stmt= $dbh->prepare('select * from serendipity.serendipity_entries where id = :id');
  $stmt->bindParam(':id', $argv[4]);
  if (!$stmt->execute()) {
    var_dump($dbh->errorInfo());
    exit;
  }

  for ($i= 0, $s= $stmt->columnCount(); $i < $s; $i++) {
    echo $i, ':: '; var_dump($stmt->getColumnMeta($i));
  }
  echo "Done\n";
?>


Expected result:
----------------
0:: array(6) {
  ["native_type"]=>
  string(4) "LONG"
  ["flags"]=>
  array(2) {
    [0]=>
    string(8) "not_null"
    [1]=>
    string(11) "primary_key"
  }
  ["name"]=>
  string(2) "id"
  ["len"]=>
  int(11)
  ["precision"]=>
  int(0)
  ["pdo_type"]=>
  int(2)
}

[...and so on...]

Actual result:
--------------
0:: array(6) {
  ["flags"]=>
  array(2) {
    [0]=>
    string(8) "not_null"
    [1]=>
    string(11) "primary_key"
  }
  ["name"]=>
  string(2) "id"
  ["len"]=>
  int(11)
  ["precision"]=>
  int(0)
  ["pdo_type"]=>
  int(2)
}

[...and so on...: Note the missing native_type...]

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-20 06:13 UTC] thekid@php.net
Patch that fixes this issue:

  http://sitten-polizei.de/pdo_mysql.diff

(also contains fix for #3529)
 [2005-02-20 18:18 UTC] hholzgra@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 [2008-10-12 15:23 UTC] webmaster at rdwonline dot com
Also, for bool aka tinyint(1) the native type doesn't show up at all.  When will this patch be ported over to PDO?
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Sep 25 22:03:39 2021 UTC