Commit Graph

26 Commits

Author SHA1 Message Date
Asheem Mamoowala
d4f4136414 Enforce Offline tile limit when merging sideloaded databases 2018-08-28 07:14:54 -07:00
Asheem Mamoowala
eb72fe580b Require minimum side-loaded database user_version=6 2018-08-28 07:14:54 -07:00
Asheem Mamoowala
fcab3a81cd Add unit tests and fixtures for OfflineDatabase::mergeDatabase 2018-08-28 07:14:54 -07:00
Ivo van Dongen
fae099933b [core] offline region definition - add support for arbitrary geometries 2018-08-20 22:49:01 +03:00
Konstantin Käfer
084c28f0bb [core] recreate offline database when it is deleted out from under our feet 2018-08-14 17:03:46 -07:00
Konstantin Käfer
6e06e55b95 WIP: use expected<T, E> for passing on errors 2018-08-14 17:03:46 -07:00
Konstantin Käfer
fa7b70945f [core] harden OfflineDatabase 2018-08-14 17:03:46 -07:00
John Firebaugh
b500577bfa [android, linux] Upgrade to SQLite 3.24.0, compiled to minimize binary size 2018-08-10 08:49:18 -07:00
Zsolt Bölöny
bc6094eb55 [core] Fix GCC8's new -Wcatch-value warnings
Polymorphic types shouldn't be caught by value, as the warning message says. Catch them by constant reference instead.
2018-06-25 10:07:04 -07:00
Konstantin Käfer
0ecdbebb09 [core] consolidate database opening workflow
Before this change, we've tried to open the database in read/write, but not create mode. In situations where the database didn't exist yet, this logged an error to the console, and we proceeded to opening it again in read/write/create mode, which actually created the file. The reason we did this is so that we could detect really old caching databases from January 2016 in case a developer upgraded from an older SDK (iOS v3.1 and earlier, Android v3.2 and earlier) that didn't have https://github.com/mapbox/mapbox-gl-native/pull/3715 yet.

However, these error messages, while innocent, look scary in the console and some users suspect that it's a bug. This change opens the file directly in read/write/create mode, omitting the first failed attempt. To handle old cache databases, we're now deleting the `http_cache` table, which was the only table in those old databases, and create the new schema, rather than deleting the entire file and recreating the Database object. In most scenarios, this will lead to one fewer opening attempt, while the database migration will continue to work for the few users who upgrade all the way from a January 2016 SDK.

Additionally, this fixes a mismatch between the Qt and non-Qt implementation: Qt doesn't support opening a file in read/write mode without the create flag. This means that we've seen a different control flow on Qt compared to the non-Qt implementation when opening a database.
2018-06-12 17:41:16 +02:00
Konstantin Käfer
4477dd4119 [core] support moving Database object during a Transaction 2018-06-12 17:41:16 +02:00
Konstantin Käfer
a50493ea51 [test] verify log messages of OfflineDatabase tests 2018-06-12 17:41:16 +02:00
Konstantin Käfer
1fbf3f2d48 [test] standardize on database file name and move I/O functions to util 2018-06-12 17:41:16 +02:00
Konstantin Käfer
31953c4c83 [test] pull out using namespace mbgl to reduce verbosity 2018-06-12 17:41:16 +02:00
Ivo van Dongen
d928908ec8 [core] offline database - batch region resource inserts 2018-06-04 12:09:32 +03:00
John Firebaugh
a1195f6a9d Avoid exceptions for flow control during database creation
Unfortuntely, it's difficult to avoid all exceptions, because sqlite3_open_v2 does not reliably return SQLITE_NOTADB if the file is not a database. However, this should avoid cases where developers misinterpret the SQLITE_CANTOPEN exception as a crash, which is the common case.
2018-05-09 07:32:16 -07:00
Konstantin Käfer
136e536159 [core, qt] move self-resetting Statement/Query object to shared header 2018-03-02 14:26:25 +01:00
Thiago Marcos P. Santos
869799a716 [tests] Added a test for getting resources from the database
This test would have flagged the Qt regression.
2018-02-26 14:43:32 +02:00
Bruno de Oliveira Abinader
f86c1b7d0f [test] Only use our SQLite3 wrapper in tests 2018-01-08 19:13:47 +02:00
Thiago Marcos P. Santos
bd15e273dc [tests] Enforce the schema downgrade behavior
Which is, delete and recreate the database.
2017-08-22 12:46:38 +03:00
Konstantin Käfer
f0a7c45064 [core] finish must-revalidate support 2017-08-08 12:40:38 +02:00
Konstantin Käfer
62ea1f2185 [core] remove trailing whitespace, add trailing newlines, add space after // 2017-01-27 11:44:16 +01:00
Bruno de Oliveira Abinader
88b7fc3929 [Qt] Implement mapbox::sqlite::{Database,Statement} using QtSql 2017-01-23 19:06:53 +02:00
Bruno de Oliveira Abinader
80d72123df [core] Move lastInsertRowId/changes to sqlite::Statement 2017-01-23 19:06:53 +02:00
Tore Halset
a4b79ac289 [core] Optimize OfflineDownload::ensureResource (#6707)
Add `OfflineDatabase::hasRegionResource`, for use when the actual contents are not needed by the caller, avoiding IO and decompression costs.
2016-10-17 09:27:07 -07:00
Konstantin Käfer
3f3fc7b772 [test] add .test.cpp suffix to test case files 2016-09-28 16:34:22 +02:00