|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-08-17 17:02 UTC] vrana@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 19:00:01 2025 UTC |
Description: ------------ I was wondering what is the default type of parameter when none is set? Reproduce code: --------------- If I run that code : $dbh = new PDO( 'mysql:host=localhost;dbname=xxx', 'xxx', 'xxx'); $stmt = $dbh->prepare('SELECT ? FROM DUAL WHERE 1 = ?'); var_dump($stmt->execute(array('aa\'aa', 'aaa'))); This dump true, meaning that 'aaa' was casted to a string and that the actual query looks like this in mySQL : SELECT 'aa''aa' FROM DUAL WHERE 1 = 'aaa' Expected result: ---------------- The documentation should indicate that when no type is provided (while calling bindParam(), bindValue(), or execute()), PDO::PARAM_STRING is used. Actual result: -------------- Neither bindParam(), bindValue() or execute() speak of a default type, nor the main page of PDO (http://fr.php.net/manual/en/ref.pdo.php) describe it. Thus, we could expect anything from the driver (like casting variable into integer instead of string).