dblayer : bug in read with OR if the select fields are multiple time the same

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2757 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2016-06-09 13:11:26 +00:00
parent 3bda1f7c63
commit 230f8b7603
2 changed files with 53 additions and 19 deletions

View File

@@ -40,7 +40,8 @@ class test_dblayer_{ENGINE} extends PHPUnit_Framework_TestCase
$dbconfig = $this->confs["{ENGINE}"];
$db = new dblayer ($dbconfig["dsn"], $dbconfig["username"],
$dbconfig["password"], $dbconfig["driver_options"]);
foreach (array ("users", "grouped", "multiple", "multiple2", "users3") as
foreach (array ("users", "grouped", "multiple", "multiple2", "users3",
"readOR") as
$table)
{
$db->table = $table;
@@ -362,4 +363,25 @@ class test_dblayer_{ENGINE} extends PHPUnit_Framework_TestCase
$db->disconnect ();
$this->assertSame (0, $res);
}
/** Check the OR feature on the same column with different value */
public function test_readOR1 ()
{
$dbconfig = $this->confs["{ENGINE}"];
$db = new dblayer ($dbconfig["dsn"], $dbconfig["username"],
$dbconfig["password"], $dbconfig["driver_options"]);
$db->table = "readOR";
$db->fields = array ("id"=>array ("integer"),
"user"=>array ("varchar", "255", "not null"));
$db->primary = "id";
$db->unique = array ("id");
$db->createTable ();
$db->insert (array ("id"=>"0", "user"=>"test0"));
$db->insert (array ("id"=>"1", "user"=>"test1"));
$res = $db->read (array (array ("id", 0), array ("id", 1)), array ("user"),
null, true);
$db->disconnect ();
$this->assertSame (array (0=>array ("user"=>"test0"),
1=>array ("user"=>"test1")), $res);
}
}