1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef SQL_TEST_TEST_HELPERS_H_
6 #define SQL_TEST_TEST_HELPERS_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
11 // Collection of test-only convenience functions.
24 // Return the number of tables in sqlite_master.
25 size_t CountSQLTables(sql::Connection* db) WARN_UNUSED_RESULT;
27 // Return the number of indices in sqlite_master.
28 size_t CountSQLIndices(sql::Connection* db) WARN_UNUSED_RESULT;
30 // Returns the number of columns in the named table. 0 indicates an
31 // error (probably no such table).
32 size_t CountTableColumns(sql::Connection* db, const char* table)
35 // Sets |*count| to the number of rows in |table|. Returns false in
36 // case of error, such as the table not existing.
37 bool CountTableRows(sql::Connection* db, const char* table, size_t* count);
39 // Creates a SQLite database at |db_path| from the sqlite .dump output
40 // at |sql_path|. Returns false if |db_path| already exists, or if
41 // sql_path does not exist or cannot be read, or if there is an error
42 // executing the statements.
43 bool CreateDatabaseFromSQL(const base::FilePath& db_path,
44 const base::FilePath& sql_path) WARN_UNUSED_RESULT;
49 #endif // SQL_TEST_TEST_HELPERS_H_