summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2017-08-22 16:13:07 -0400
committerJason Wray <jason@mapbox.com>2017-08-29 14:08:30 -0400
commiteedd90961168037954e534507f632fac7cb0a8ae (patch)
tree22aa83485042a33ee899a16025fedfc7c2107764
parent2640109887655b3aa0cb1a2d06ddb093282d03b7 (diff)
downloadqtlocation-mapboxgl-eedd90961168037954e534507f632fac7cb0a8ae.tar.gz
[tests] Cherry-pick OfflineDatabase::databaseTableColumns
Originally part of the much larger f0a7c45064c3ce3f509b1c2035fcaa07ccc35a99
-rw-r--r--test/storage/offline_database.test.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/storage/offline_database.test.cpp b/test/storage/offline_database.test.cpp
index 243d0dc43c..fbf515679e 100644
--- a/test/storage/offline_database.test.cpp
+++ b/test/storage/offline_database.test.cpp
@@ -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;