summaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file.c')
-rw-r--r--file.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/file.c b/file.c
index 5e8ab381f..e8fc2b5cd 100644
--- a/file.c
+++ b/file.c
@@ -160,6 +160,7 @@ static int try_to_open_db(const char *filename, struct memblock *mem)
{
sqlite3 *handle;
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%'";
int retval;
@@ -170,6 +171,14 @@ static int try_to_open_db(const char *filename, struct memblock *mem)
return 1;
}
+ /* Testing if DB schema resembles Suunto DM5 database format */
+ retval = sqlite3_exec(handle, dm5_test, &db_test_func, 0, NULL);
+ if (!retval) {
+ retval = parse_dm5_buffer(handle, filename, mem->buffer, mem->size, &dive_table);
+ sqlite3_close(handle);
+ return retval;
+ }
+
/* Testing if DB schema resembles Suunto DM4 database format */
retval = sqlite3_exec(handle, dm4_test, &db_test_func, 0, NULL);
if (!retval) {