$data["access_date"] = MetabaseToday(); $data["access_time"] = MetabaseTime(); $data["approved"] = MetabaseNow(); if (!InsertTestValues($database, $prepared_query, $data) || !MetabaseRollbackTransaction($database) || !($result = MetabaseQuery($database, "SELECT * FROM users"))) { $success = 0; } else { if (!MetabaseEndOfResult($database, $result)) { $pass = 0; echo "FAILED!{$eol}"; $failed++; echo "Test {$test}: transaction rollback did not revert the row that was inserted{$eol}"; } MetabaseFreeResult($database, $result); } if ($success && $pass) { if (!InsertTestValues($database, $prepared_query, $data) || !MetabaseCommitTransaction($database) || !($result = MetabaseQuery($database, "SELECT * FROM users"))) { $success = 0; } else { if (MetabaseEndOfResult($database, $result)) { $pass = 0; echo "FAILED!{$eol}"; $failed++; echo "Test {$test}: transaction commit did not make permanent the row that was inserted{$eol}"; } MetabaseFreeResult($database, $result); } } if ($success && $pass) { if (!($result = MetabaseQuery($database, "DELETE FROM users"))) { $success = 0; }
flush(); $pass = 1; if (!MetabaseQuery($database, "DELETE FROM users") || !($prepared_query = MetabasePrepareQuery($database, "INSERT INTO users (user_name,user_password,subscribed,user_id,quota,weight,access_date,access_time,approved) VALUES (?,?,?,?,?,?,?,?,?)"))) { $success = 0; } else { $data = array(); $data["user_password"] = ""; $data["subscribed"] = 0; $data["quota"] = 0; $data["weight"] = 0; $data["access_date"] = MetabaseToday(); $data["access_time"] = MetabaseTime(); $data["approved"] = MetabaseNow(); for ($v = 0, Reset($values); $v < count($values); Next($values), $v++) { $data["user_name"] = $values[$data["user_id"] = Key($values)]; if (!InsertTestValues($database, $prepared_query, $data)) { $success = 0; break; } } MetabaseFreePreparedQuery($database, $prepared_query); if ($success) { $queries = array(MetabaseBeginsWith($database, "%") => array(1), MetabaseEndsWith($database, "%") => array(3), MetabaseContains($database, "%") => array(1, 2, 3, 9), "NOT " . MetabaseContains($database, "%") => array(4, 5, 6, 7, 8), MetabaseBeginsWith($database, "_") => array(5), MetabaseEndsWith($database, "_") => array(7), MetabaseContains($database, "_") => array(5, 6, 7, 9), "NOT " . MetabaseContains($database, "_") => array(1, 2, 3, 4, 8), MetabaseMatchPattern($database, array("begin", "%", "end")) => array(2, 4, 6, 8), MetabaseMatchPattern($database, array("begin", "_", "end")) => array(2, 6), MetabaseMatchPattern($database, array("%", "%", "end")) => array(1), MetabaseMatchPattern($database, array("_", "%", "end")) => array(5), MetabaseMatchPattern($database, array(" _@%\\ ]['?*")) => array(9)); for ($q = 0, Reset($queries); $q < count($queries); Next($queries), $q++) { $condition = Key($queries); if (!MetabaseQueryColumn($database, "SELECT user_id FROM users WHERE user_name " . $condition . " ORDER BY user_id", $rows, "integer")) { $success = 0; break; } if (count($queries[$condition]) != count($rows)) { $pass = 0;