chromium/sql/test/test_helpers.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "sql/test/test_helpers.h"

#include <stddef.h>
#include <stdint.h>

#include <limits>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <tuple>
#include <vector>

#include "base/check.h"
#include "base/check_op.h"
#include "base/containers/span.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/numerics/byte_conversions.h"
#include "base/strings/string_util.h"
#include "base/threading/thread_restrictions.h"
#include "sql/database.h"
#include "sql/statement.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/sqlite/sqlite3.h"

namespace sql::test {

namespace {

size_t CountSQLItemsOfType(sql::Database* db, const char* type) {}

// Read the number of the root page of a B-tree (index/table).
//
// Returns a 0-indexed page number, not the raw SQLite page number.
std::optional<int> GetRootPage(sql::Database& db, std::string_view tree_name) {}

[[nodiscard]] bool IsWalDatabase(const base::FilePath& db_path) {}

[[nodiscard]] bool CorruptSizeInHeaderMemory(base::span<uint8_t> header,
                                             int64_t db_size) {}

}  // namespace

std::optional<int> ReadDatabasePageSize(const base::FilePath& db_path) {}

bool CorruptSizeInHeader(const base::FilePath& db_path) {}

bool CorruptSizeInHeaderWithLock(const base::FilePath& db_path) {}

bool CorruptIndexRootPage(const base::FilePath& db_path,
                          std::string_view index_name) {}

size_t CountSQLTables(sql::Database* db) {}

size_t CountSQLIndices(sql::Database* db) {}

size_t CountTableColumns(sql::Database* db, const char* table) {}

bool CountTableRows(sql::Database* db, const char* table, size_t* count) {}

bool CreateDatabaseFromSQL(const base::FilePath& db_path,
                           const base::FilePath& sql_path) {}

std::string IntegrityCheck(sql::Database& db) {}

std::string ExecuteWithResult(sql::Database* db, const base::cstring_view sql) {}

std::string ExecuteWithResults(sql::Database* db,
                               const base::cstring_view sql,
                               const base::cstring_view column_sep,
                               const base::cstring_view row_sep) {}

int GetPageCount(sql::Database* db) {}

// static
ColumnInfo ColumnInfo::Create(sql::Database* db,
                              const std::string& db_name,
                              const std::string& table_name,
                              const std::string& column_name) {}

}  // namespace sql::test