|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-02-20 06:13 UTC] thekid@php.net
[2005-02-20 18:18 UTC] hholzgra@php.net
[2008-10-12 15:23 UTC] webmaster at rdwonline dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 10:00:01 2025 UTC |
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...]