note 110216 added to pdo.setattribute

From: Date: Mon, 01 Oct 2012 20:39:38 +0000
Subject: note 110216 added to pdo.setattribute
Groups: php.notes 
Request: Send a blank email to php-notes+get-191093@lists.php.net to get a copy of this message
This paramter does magic (at least for MySQL): PDO::ATTR_EMULATE_PREPARES => false I don't know why, but it allows you to get the real types of a column value. When you don't use it, any type returned by PDO will be a string (or NULL), even if it's been saved as an integer or float. Typecasting in PHP can be very painful and may slow down your application a lot. With ATTR_EMULATE_PREPARES set to FALSE, integers and floats (also doubles) are really ints and floats in PHP. For information: - The datatype decimal still returns a string to keep the precision. - As MySQL doesn't know the datatype Boolean, the expression 1 = 1 returns 1 and not TRUE. ---- Server IP: 69.147.83.199 Probable Submitter: 87.65.176.202 ---- Manual Page -- http://www.php.net/manual/en/pdo.setattribute.php Edit -- https://master.php.net/note/edit/110216 Del: integrated -- https://master.php.net/note/delete/110216/integrated Del: useless -- https://master.php.net/note/delete/110216/useless Del: bad code -- https://master.php.net/note/delete/110216/bad+code Del: spam -- https://master.php.net/note/delete/110216/spam Del: non-english -- https://master.php.net/note/delete/110216/non-english Del: in docs -- https://master.php.net/note/delete/110216/in+docs Del: other reasons-- https://master.php.net/note/delete/110216 Reject -- https://master.php.net/note/reject/110216 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#191093) next »