|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-05-07 18:08 UTC] lsmith@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 04:00:01 2025 UTC |
Description: ------------ PDO fetch doesn't preserve the case of the column. I don't know if this is a "feature" or if it is a bug, but if it is a "feature" since the beginning of PDO, could I also suggest that another flag be added for PDO fetch to tell it to preserve the case? Reproduce code: --------------- <?php try { $pdo = new PDO("pgsql:host={$host};dbname={$database}", $user, $password); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $pdo->query("SET search_path to {$schema}"); $accountState = $pdo->prepare(' SELECT id AS accountId FROM account WHERE id = ? '); $accountState->bindParam(1, $id, PDO::PARAM_INT); $accountState->execute(); $getAccount = $accountState->fetch(PDO::FETCH_OBJ); $accountState->closeCursor(); var_dump($getAccount); } catch (Exception $e){ print "An error occurred: {$e->getMessage()}"; } ?> Expected result: ---------------- object(stdClass)#8 (1) { ["accountId"]=> int(339) } Actual result: -------------- object(stdClass)#8 (1) { ["accountid"]=> int(339) }