summaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2014-12-20 18:19:43 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-12-20 11:28:57 -0800
commit3be4aa47b5adfff7a730423096c8dcd1efbebc30 (patch)
tree776f9476690cde6b229e643f5cb119726c8fec4d /file.c
parent683d6e133930a08e3a4554ab54334d1e4bcf042f (diff)
downloadsubsurface-3be4aa47b5adfff7a730423096c8dcd1efbebc30.tar.gz
Bare implementation of Cobalt Divelog Program
This implements importing of dive profile and temperature graph along with some meta data from a Cobalt Divelog database. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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 04936a59e..89f9c1f54 100644
--- a/file.c
+++ b/file.c
@@ -165,6 +165,7 @@ static int try_to_open_db(const char *filename, struct memblock *mem)
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 cobalt_test[] = "select count(*) from sqlite_master where type='table' and name='TrackPoints' and sql like '%DepthPressure%'";
int retval;
retval = sqlite3_open(filename, &handle);
@@ -198,6 +199,14 @@ static int try_to_open_db(const char *filename, struct memblock *mem)
return retval;
}
+ /* Testing if DB schema resembles Atomic Cobalt database format */
+ retval = sqlite3_exec(handle, cobalt_test, &db_test_func, 0, NULL);
+ if (!retval) {
+ retval = parse_cobalt_buffer(handle, filename, mem->buffer, mem->size, &dive_table);
+ sqlite3_close(handle);
+ return retval;
+ }
+
sqlite3_close(handle);
return retval;