summaryrefslogtreecommitdiffstats
path: root/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2015-07-12 23:16:50 +0530
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-12 13:58:16 -0700
commitc87d7d96b5a3a00fcd21a792a29500ffd5479567 (patch)
tree9d1c26f161b932a376ad3c3890a2d0df952233df /parse-xml.c
parente98cbdf0205fd0903c63b4879096da013e6671a0 (diff)
downloadsubsurface-c87d7d96b5a3a00fcd21a792a29500ffd5479567.tar.gz
Divinglog import: import a bit more data from DB
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'parse-xml.c')
-rw-r--r--parse-xml.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/parse-xml.c b/parse-xml.c
index 62eceaa83..9d6cb3adc 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -2869,14 +2869,40 @@ extern int divinglog_dive(void *param, int columns, char **data, char **column)
if (data[6])
cur_dive->dc.duration.seconds = atoi(data[6]) * 60;
+ if (data[7])
+ utf8_string(data[7], &cur_dive->divemaster);
+
+ if (data[8])
+ cur_dive->airtemp.mkelvin = C_to_mkelvin(atol(data[8]));
+
+ if (data[9])
+ cur_dive->watertemp.mkelvin = C_to_mkelvin(atol(data[9]));
+
+ if (data[10]) {
+ cur_dive->weightsystem[0].weight.grams = atol(data[10]) * 1000;
+ cur_dive->weightsystem[0].description = strdup(translate("gettextFromC", "unknown"));
+ }
+
+ if (data[11])
+ cur_dive->suit = strdup(data[11]);
+
settings_start();
dc_settings_start();
- cur_settings.dc.model = strdup("Divinglog import");
+
+ if (data[12]) {
+ cur_dive->dc.model = strdup(data[12]);
+ } else {
+ cur_settings.dc.model = strdup("Divinglog import");
+ }
dc_settings_end();
settings_end();
- cur_dive->dc.model = strdup("Divinglog import");
+ if (data[12]) {
+ cur_dive->dc.model = strdup(data[12]);
+ } else {
+ cur_dive->dc.model = strdup("Divinglog import");
+ }
dive_end();
return SQLITE_OK;
@@ -2890,7 +2916,7 @@ int parse_divinglog_buffer(sqlite3 *handle, const char *url, const char *buffer,
char *err = NULL;
target_table = table;
- char get_dives[] = "select Number,strftime('%s',Divedate || ' ' || ifnull(Entrytime,'00:00')),Country || ' - ' || City || ' - ' || Place,Buddy,Comments,Depth,Divetime from Logbook where UUID not in (select UUID from DeletedRecords)";
+ char get_dives[] = "select Number,strftime('%s',Divedate || ' ' || ifnull(Entrytime,'00:00')),Country || ' - ' || City || ' - ' || Place,Buddy,Comments,Depth,Divetime,Divemaster,Airtemp,Watertemp,Weight,Divesuit,Computer from Logbook where UUID not in (select UUID from DeletedRecords)";
retval = sqlite3_exec(handle, get_dives, &divinglog_dive, handle, &err);