summaryrefslogtreecommitdiffstats
path: root/core/file.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-01-07 09:31:12 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-01-07 09:31:12 -0800
commitda52440963ac8920acab82502114b74c98e170a1 (patch)
tree1c00748693887e0418ff875ab9ba8722f081a98b /core/file.c
parent4b7b0f2dec7c5106683c1d42e38a59b01308b71a (diff)
parentfd5aad719208f35252bacc9a7a46c829fc631923 (diff)
downloadsubsurface-da52440963ac8920acab82502114b74c98e170a1.tar.gz
Merge branch 'shearwater_cloud' of https://github.com/mturkia/subsurface
Diffstat (limited to 'core/file.c')
-rw-r--r--core/file.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/file.c b/core/file.c
index 6f2edcf8d..fe2b0878b 100644
--- a/core/file.c
+++ b/core/file.c
@@ -132,6 +132,7 @@ static int try_to_open_db(const char *filename, struct memblock *mem, struct div
char dm4_test[] = "select count(*) from sqlite_master where type='table' and name='Dive' and sql like '%ProfileBlob%'";
char dm5_test[] = "select count(*) from sqlite_master where type='table' and name='Dive' and sql like '%SampleBlob%'";
char shearwater_test[] = "select count(*) from sqlite_master where type='table' and name='system' and sql like '%dbVersion%'";
+ char shearwater_cloud_test[] = "select count(*) from sqlite_master where type='table' and name='SyncV3MetadataDiveLog' and sql like '%CreatedDevice%'";
char cobalt_test[] = "select count(*) from sqlite_master where type='table' and name='TrackPoints' and sql like '%DepthPressure%'";
char divinglog_test[] = "select count(*) from sqlite_master where type='table' and name='DBInfo' and sql like '%PrgName%'";
int retval;
@@ -167,6 +168,14 @@ static int try_to_open_db(const char *filename, struct memblock *mem, struct div
return retval;
}
+ /* Testing if DB schema resembles Shearwater cloud database format */
+ retval = sqlite3_exec(handle, shearwater_cloud_test, &db_test_func, 0, NULL);
+ if (!retval) {
+ retval = parse_shearwater_cloud_buffer(handle, filename, mem->buffer, mem->size, table);
+ sqlite3_close(handle);
+ return retval;
+ }
+
/* Testing if DB schema resembles Atomic Cobalt database format */
retval = sqlite3_exec(handle, cobalt_test, &db_test_func, 0, NULL);
if (!retval) {