Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[tests] Cherry-pick OfflineDatabase::databaseTableColumns
Browse files Browse the repository at this point in the history
Originally part of the much larger f0a7c45
  • Loading branch information
friedbunny committed Aug 24, 2017
1 parent e3abc45 commit 5ef5df3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/storage/offline_database.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,17 @@ static int databaseSyncMode(const std::string& path) {
return stmt.get<int>(0);
}

static std::vector<std::string> databaseTableColumns(const std::string& path, const std::string& name) {
mapbox::sqlite::Database db(path, mapbox::sqlite::ReadOnly);
const auto sql = std::string("pragma table_info(") + name + ")";
mapbox::sqlite::Statement stmt = db.prepare(sql.c_str());
std::vector<std::string> columns;
while (stmt.run()) {
columns.push_back(stmt.get<std::string>(1));
}
return columns;
}

TEST(OfflineDatabase, MigrateFromV2Schema) {
using namespace mbgl;

Expand Down

0 comments on commit 5ef5df3

Please sign in to comment.