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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC