Beispiel #1
0
$insertLastId = "id";
sleep(1);
$db->onDuplicate($updateColumns, "id");
$db->insert("users", $user);
$nUser = $db->where('login', 'user3')->get('users');
if ($db->count != 1) {
    echo "onDuplicate update failed. ";
    exit;
}
if ($nUser[0]['createdAt'] == $nUser[0]['updatedAt']) {
    echo "onDuplicate2 update failed. ";
    exit;
}
// order by field
$db->orderBy("login", "asc", array("user3", "user2", "user1"));
$login = $db->getValue("users", "login");
if ($login != "user3") {
    echo "order by field test failed";
    exit;
}
$db->where("active", true);
$users = $db->get("users");
if ($db->count != 1) {
    echo "Invalid total insert count with boolean";
    exit;
}
$db->where("active", false);
$db->update("users", array("active" => $db->not()));
if ($db->count != 2) {
    echo "Invalid update count with not()";
    exit;