echo "FAILED!{$eol}"; $failed++; echo "Test {$test}: the query column field \"{$field}\" of type {$type} for row {$row} was returned in \"" . $value[$row] . "\" unlike \"" . $data[$row][$field] . "\" as expected{$eol}"; break 2; } } } } if ($success && $pass) { for ($fields = "", Reset($data[0]), $column = 0; $column < count($data[0]); Next($data[0]), $column++) { if ($column > 0) { $fields .= ","; } $fields .= Key($data[0]); } if ($success = MetabaseQueryAll($database, "SELECT {$fields} FROM users ORDER BY user_id", $value, $types)) { for ($row = 0; $row < $total_rows; $row++) { for (Reset($data[$row]), $column = 0; $column < count($data[$row]); Next($data[$row]), $column++) { $field = Key($data[$row]); if (strcmp(strval($data[$row][$field]), strval($value[$row][$column]))) { $pass = 0; echo "FAILED!{$eol}"; $failed++; echo "Test {$test}: the query all field \"{$field}\" of for row {$row} was returned in \"" . $value[$row][$column] . "\" unlike \"" . $data[$row][$field] . "\" as expected{$eol}"; break 2; } } } } } if ($success && $pass) {
if (($omit || MetabaseQuerySetKey($database, $prepared_query, 1, $table)) && MetabaseExecuteQuery($database, $prepared_query) && MetabaseGetInsertedKey($database, $table, $inserted_id)) { if ($inserted_id != $id) { $pass = 0; echo "FAILED!{$eol}"; $failed++; echo "Test {$test}: inserted autoincrement key is {$inserted_id} and not {$id} as expected{$eol}"; break; } } else { $success = 0; break; } } if ($success && $pass) { $types = array("integer", "text", "text", "integer", "float"); if (MetabaseQueryAll($database, "SELECT id, title, body, author, score FROM {$table} ORDER BY id", $records, $types)) { for ($record = 0; $record < $rows; $record++) { if ($records[$record][0] != $start_id + $record) { $pass = 0; echo "FAILED!{$eol}"; $failed++; echo "Test {$test}: retrieved autoincrement key is " . $records[$record][0] . " and not " . strval($start_id + $record) . " as expected{$eol}"; break; } if (strcmp($records[$record][1], $title . " - " . $record)) { $pass = 0; echo "FAILED!{$eol}"; $failed++; echo "Test {$test}: retrieved autoincrement key record field is \"" . $records[$record][1] . "\" and not \"" . ($title . " - " . $record) . "\" as expected{$eol}"; break; }