aboutsummaryrefslogtreecommitdiffstats
path: root/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2014-01-09 23:14:50 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-10 16:13:29 +0700
commit18e625129e9e309ca879fb41d648772a35c30beb (patch)
treeaf04dc7e056b0a515d7263b49f32bfc37480ec67 /parse-xml.c
parentb79ef63388dea9954037dbc5c9406c8de649ec32 (diff)
downloadsubsurface-18e625129e9e309ca879fb41d648772a35c30beb.tar.gz
Import tags from Suunto database file
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.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/parse-xml.c b/parse-xml.c
index db26190b9..2e456953d 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -1714,6 +1714,14 @@ extern int dm4_events(void *handle, int columns, char **data, char **column)
return 0;
}
+extern int dm4_tags(void *handle, int columns, char **data, char **column)
+{
+ if(data[0])
+ taglist_add_tag(cur_dive->tag_list, data[0]);
+
+ return 0;
+}
+
extern int dm4_dive(void *param, int columns, char **data, char **column)
{
int i, interval, retval = 0;
@@ -1723,6 +1731,7 @@ extern int dm4_dive(void *param, int columns, char **data, char **column)
int *pressureBlob;
char *err = NULL;
char get_events_template[] = "select * from Mark where DiveId = %d";
+ char get_tags_template[] = "select Text from DiveTag where DiveId = %d";
char get_events[64];
dive_start();
@@ -1816,6 +1825,13 @@ extern int dm4_dive(void *param, int columns, char **data, char **column)
return 1;
}
+ snprintf(get_events, sizeof(get_events) - 1, get_tags_template, cur_dive->number);
+ retval = sqlite3_exec(handle, get_events, &dm4_tags, 0, &err);
+ if (retval != SQLITE_OK) {
+ fprintf(stderr, "%s", translate("gettextFromC","Database query get_tags failed.\n"));
+ return 1;
+ }
+
dive_end();
/*