#38389 [Opn->Csd]: What is the default type of bindParam(), bindValue() and execute(array) ? (PDO)

From: Date: Fri, 17 Aug 2007 17:02:21 +0000
Subject: #38389 [Opn->Csd]: What is the default type of bindParam(), bindValue() and execute(array) ? (PDO)
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969377667@lists.php.net to get a copy of this message
ID: 38389 Updated by: vrana@php.net Reported By: baldurien at bbnwn dot eu -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Irrelevant PHP Version: Irrelevant New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. "Defaults to PHP native type." Previous Comments: ------------------------------------------------------------------------ [2006-08-08 21:59:20] baldurien at bbnwn dot eu 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). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38389&edit=1

« previous php.doc (#969377667) next »