PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB » Bug #1099

db_common->prepare() doesn't allow escaped ?&!

Details

Submitted2004-03-30 21:46 UTC
Fromwingetr at cs dot byuh dot edu
Assigneddanielc
StatusBogus
PackageDB
PHP Version4.3.4
OSFedora Core 1 (linux)
Roadmaps(Not assigned)

Comments

[2004-03-30 21:46 UTC] wingetr at cs dot byuh dot edu

Description:
------------
prepare doesn't allow a way to escape the placeholders within the query string.

Reproduce code:
---------------
$compiled = $db->prepare("SELECT * FROM grades WHERE COURSE='Speech \& Debate'");
$result = $dbh->execute($compiled);

Expected result:
----------------
(nothing)

Actual result:
--------------
DB Error: insufficient data supplied

Backtrace:

[0]=>
array(5) {
["file"]=>
string(24) "/disk/web/lib/php/DB.php"
["line"]=>
int(642)
["function"]=>
string(10) "pear_error"
["class"]=>
string(8) "db_error"
["type"]=>
string(2) "->"
}
[1]=>
array(5) {
["file"]=>
string(26) "/disk/web/lib/php/PEAR.php"
["line"]=>
int(525)
["function"]=>
string(8) "db_error"
["class"]=>
string(8) "db_error"
["type"]=>
string(2) "->"
}
[2]=>
array(5) {
["file"]=>
string(31) "/disk/web/lib/php/DB/common.php"
["line"]=>
int(298)
["function"]=>
string(10) "raiseerror"
["class"]=>
string(4) "pear"
["type"]=>
string(2) "::"
}
[3]=>
array(5) {
["file"]=>
string(31) "/disk/web/lib/php/DB/common.php"
["line"]=>
int(608)
["function"]=>
string(10) "raiseerror"
["class"]=>
string(8) "db_mysql"
["type"]=>
string(2) "->"
}
[4]=>
array(5) {
["file"]=>
string(31) "/disk/web/lib/php/DB/common.php"
["line"]=>
int(559)
["function"]=>
string(19) "executeemulatequery"
["class"]=>
string(8) "db_mysql"
["type"]=>
string(2) "->"
}