PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #1524

AutoExecute function return wrong object on Error

Details

Submitted2004-05-28 14:08 UTC
Fromeber at eacnet dot com dot br
Assigneddanielc
StatusBogus
PackageDB
PHP Version5.0.0RC2 (Release Candidate 2)
OSLinux 1386
Roadmaps(Not assigned)

Comments

[2004-05-28 14:08 UTC] eber at eacnet dot com dot br

Description:
------------
I have a problem with the following code:

...
$result = $object->autoExecute(myTable, $arrayFields,
DB_AUTOQUERY_INSERT);

/* error */
if(DB::isError($result))
echo "Error";
else
echo "Ok";

I've passed a $arrayFields with a structure incorret. In PHP4 (4.3.2), the message "Error" is printed and on PHP5 (RC2), the message "Ok" is printed.

What is going on is that on PHP4 AutoExecute return DB_Error on Error and in PHP5, it returns DB_Result even if an error is found.

Thank you.

[2004-05-28 14:37 UTC] eber at eacnet dot com dot br

Table I used:

CREATE TABLE foo (
id int not null primary key,
name char(30)
);

Command:

$arrayFields = array("id" => 1,
"fld" => "teste");
$result = $object->autoExecute("foo", $arrayFields,
DB_AUTOQUERY_INSERT);

I'm using PEAR::DB version 1.5.0RC2

[2004-05-28 14:53 UTC] eber at eacnet dot com dot br

Problem is solved with version 1.6.4

Thank you.