/// $db->where("id = ? or id = ?", array(1, 2)); $res = $db->get("users"); if ($db->count != 2) { echo "Invalid users count on select with multiple params"; exit; } /// $db->where("id = 1 or id = 2"); $res = $db->get("users"); if ($db->count != 2) { echo "Invalid users count on select with multiple params"; exit; } /// $usersQ = $db->subQuery(); $usersQ->where("login", "user2"); $usersQ->getOne("users", "id"); $db->where("userId", $usersQ); $cnt = $db->getValue("products", "count(id)"); if ($cnt != 2) { echo "Invalid select result with subquery"; exit; } /// $dbi_sub = $db->subQuery(); $dbi_sub->where('active', 1); $dbi_sub->get('users', null, 'id'); $db->where('id', $dbi_sub, 'IN'); $cnt = $db->copy(); $c = $cnt->getValue('users', "COUNT(id)");
echo "Invalid products count on join ()"; exit; } $db->where("id = ? or id = ?", array(1, 2)); $res = $db->get("users"); if ($db->count != 2) { echo "Invalid users count on select with multiple params"; exit; } $db->where("id = 1 or id = 2"); $res = $db->get("users"); if ($db->count != 2) { echo "Invalid users count on select with multiple params"; exit; } $usersQ = $db->subQuery(); $usersQ->where("login", "user2"); $usersQ->getOne("users", "id"); $db2 = $db->copy(); $db2->where("userId", $usersQ); $res = $db2->getOne("products", "count(id) as cnt"); if ($res['cnt'] != 2) { echo "Invalid select result with subquery"; exit; } //TODO: insert test $db->delete("users"); $db->get("users"); if ($db->count != 0) { echo "Invalid users count after delete"; exit;