exit; } $q = "drop table {$prefix}test;"; $db->rawQuery($q); $db->orderBy("`id`", "asc"); $users = $db->get("users"); if ($db->count != 3) { echo "Invalid total insert count"; exit; } // insert with on duplicate key update $user = array('login' => 'user3', 'active' => true, 'customerId' => 11, 'firstName' => 'Pete', 'lastName' => 'D', 'password' => $db->func('SHA1(?)', array("secretpassword2+salt")), 'createdAt' => $db->now(), 'updatedAt' => $db->now(), 'expires' => $db->now('+1Y'), 'loginCount' => $db->inc(3)); $updateColumns = array("updatedAt"); $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";