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 » MDB2 » Bug #8707

MDB2::bindValue() doesn't work in LiveUser Example4

Details

Submitted2006-09-15 09:28 UTC
Frommark dot busse at 1000grad dot de
StatusBogus
PackageMDB2
PHP Version5.1.4
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2006-09-15 09:28 UTC] mark dot busse at 1000grad dot de

Description:
------------
In LiveUser, demodata.php?dsn=mysql://root:@localhost/liveuser_test_example4&file=example4/demodata.xml&create=1 fails with error "Unable to bind to missing placeholder:...".

Test script:
---------------
<?php
ini_set('include_path', 'c:/xampp/xampp/php/pear'.PATH_SEPARATOR.'..'.PATH_SEPARATOR.ini_get('include_path'));

require_once 'MDB2/Schema.php';
$dsn = MDB2::parseDSN("mysql://root:@localhost:3309/liveuser_test_example4");
$database = $dsn['database'];
unset($dsn['database']);

$manager =& MDB2_Schema::factory($dsn, array());
$res = $manager->updateDatabase(
"C:/xampp/xampp/htdocs/peardocs/LiveUser/docs/examples/example4/demodata.xml",
false,
array('database' => $database, 'create' => 1,)
);

if (PEAR::isError($res))
echo("<br />error message: ".$res->message."<br />userinfo: ".$res->userinfo);
else
echo("Ok.");
?>

Patch: Change in MDB2::bindValue() the line
OLD: if (!in_array($parameter, $this->positions))
NEW: if (!in_array($parameter, array_keys($this->positions)))

Expected result:
----------------
Ok.

Actual result:
--------------
error message: MDB2 Error: not found
userinfo: _execute: [Error message: Unable to bind to missing placeholder: application_id] [Last query: PREPARE MDB2_Statement_mysql_2580e8af9a3f119dd888f49fa9a56c21 FROM 'INSERT INTO liveuser_applications (application_id,application_define_name) VALUES (?,?)'] [Native code: 0]

[2006-09-15 10:39 UTC] mark dot busse at 1000grad dot de

the problem appears also under linux.

[2006-09-15 11:14 UTC] mark dot busse at 1000grad dot de

Okay - I forgot to update the relevant MySQL driver.
Thanks for the info.