Esempio n. 1
0
    echo "Invalid total insert count with boolean";
    exit;
}
// TODO
//$db->where("createdAt", Array (">" => $db->interval("-1h")));
//$users = $db->get("users");
//print_r ($users);
$db->where("firstname", array('LIKE' => '%John%'));
$users = $db->get("users");
if ($db->count != 1) {
    echo "Invalid insert count in LIKE: " . $db->count;
    print_r($users);
    echo $db->getLastQuery();
    exit;
}
$db->groupBy("customerId");
$cnt = $db->get("users", null, "customerId, count(id) as cnt");
if ($db->count != 2) {
    echo "Invalid records count with group by";
}
$upData = array('expires' => $db->now("+5M", "expires"), 'loginCount' => $db->inc());
$db->where("id", 1);
$cnt = $db->update("users", $upData);
if ($db->count != 1) {
    echo "Invalid update count with functions";
    exit;
}
$db->where("id", 1);
$r = $db->getOne("users");
if ($db->count != 1) {
    echo "Invalid users count on getOne()";