[PATCH 14/17] Divinglog import: use dive ID as identifier

Miika Turkia miika.turkia at gmail.com
Sun Jul 12 10:46:59 PDT 2015


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 <miika.turkia at gmail.com>
---
 parse-xml.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/parse-xml.c b/parse-xml.c
index 97e3785..bca7345 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");
-- 
2.1.4



More information about the subsurface mailing list