From c91ee860f2dff268182d80bb8f64b0ea5109c58b Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Sun, 12 Jul 2015 23:16:59 +0530 Subject: Divinglog import: use dive ID as identifier Since mapping cylinders requires use of dive ID, we might as well use the ID to map the profile also. Signed-off-by: Miika Turkia Signed-off-by: Dirk Hohndel --- parse-xml.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/parse-xml.c b/parse-xml.c index 97e378571..bca7345cc 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -2985,7 +2985,7 @@ extern int divinglog_dive(void *param, int columns, char **data, char **column) int retval = 0, diveid; sqlite3 *handle = (sqlite3 *)param; char *err = NULL; - char get_profile_template[] = "select ProfileInt,Profile,Profile2 from Logbook where Number = %d"; + char get_profile_template[] = "select ProfileInt,Profile,Profile2 from Logbook where ID = %d"; char get_cylinder_template[] = "select TankID,TankSize,PresS,PresE,PresW,O2,He,DblTank from Tank where LogID = %d order by TankID"; char get_buffer[1024]; @@ -3053,13 +3053,7 @@ extern int divinglog_dive(void *param, int columns, char **data, char **column) cur_dive->dc.model = strdup("Divinglog import"); } - /* - * Parse Profile - depth and warnings - * I am assuming that dive number is unique, but if not, then we - * will have to use ID instead. - */ - - snprintf(get_buffer, sizeof(get_buffer) - 1, get_profile_template, cur_dive->number); + snprintf(get_buffer, sizeof(get_buffer) - 1, get_profile_template, diveid); retval = sqlite3_exec(handle, get_buffer, &divinglog_profile, 0, &err); if (retval != SQLITE_OK) { fprintf(stderr, "%s", "Database query divinglog_profile failed.\n"); -- cgit v1.2.3-70-g09d2